Exemple #1
0
 public void UpdatePage(CMSPageUpdateRequest req)
 {
     dataProvider.ExecuteNonQuery(
         "CMSPages_Update",
         inputParamMapper: (parameters) =>
     {
         parameters.AddWithValue("@Path", req.Path);
         parameters.AddWithValue("@TemplateId", req.TemplateId);
         parameters.AddWithValue("@ValuesJSON", req.ValuesJSON.ToString());
         parameters.AddWithValue("@IsPublic", req.IsPublic);
         parameters.AddWithValue("@HideNavBars", req.HideNavBars);
         parameters.AddWithValue("@Name", req.Name);
         parameters.AddWithValue("@Id", req.Id);
     });
 }
 public HttpResponseMessage UpdatePage(int id, CMSPageUpdateRequest req)
 {
     if (req == null)
     {
         ModelState.AddModelError("", "You did not add any body data");
     }
     if (req.Id != id)
     {
         ModelState.AddModelError("Id", "Id in the URL does not match the Id in the body");
     }
     if (!ModelState.IsValid)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
     }
     cmsService.UpdatePage(req);
     return(Request.CreateResponse(HttpStatusCode.OK, new SuccessResponse()));
 }