Here i am pasting the methods which i used in WCF
IGallery.cs
-----------------
[ServiceContract]
public interface IGallery
{
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
string UpdateListData(string ID, string columnData);
}
Gallery.cs
------------------
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Gallery : IGallery
{
public string UpdateListData(string listItemId, string columnData)
{
try
{
SPSite site = new SPSite(SPContext.Current.Site.Url);
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite osite = new SPSite(site.ID))
{
using (SPWeb web = osite.OpenWeb())
{
SPList list = web.Lists["PhotoGallery"];
if (Convert.ToInt32(listItemId.ToString()) != 0)
{
SPListItem item = list.Items.GetItemById(Convert.ToInt32(listItemId.ToString()));
if (item != null)
{
item["LikesCount"] = columnData;
item.Update();
}
}
}
}
});
return "Success";
}
catch (SPException)
{
return "Fail";
}
}
}
Please help me ...
Thanks in Advanced
Gaja
Replies
Know the answer? Post it — somebody with the same question will find it here.