private ContentResult LikePost(LikeCreateDeleteModel model, string endpoint, Func <string, NameValueCollection, ContentResult> request) { if (!ModelState.IsValid) { return(Content(@"{""success"":""false"",""error"":""Model state is not valid.""}", "application/json")); } var options = new NameValueCollection(); if (!string.IsNullOrEmpty(model.Url)) { options.Add("ContentUrl", model.Url); } if (!string.IsNullOrEmpty(model.ContentTypeId)) { options.Add("ContentTypeId", model.ContentTypeId); } if (!string.IsNullOrEmpty(model.ContentId)) { options.Add("ContentId", model.ContentId); } return(request(endpoint, options)); }
public ContentResult LikeDelete(LikeCreateDeleteModel model) { return(LikePost(model, Endpoints.LikeJson, Delete)); }