public JsonResponse <JS.Page> Create([JsonRequestBodyAttribute] JS.Page page) { return(JsonResponse.Catch(() => { var p = Pages.Add(new Page { Url = page.Path, SiteId = Sites.CurrentSiteId }); UnitOfWork.Commit(); return new JS.Page { Id = p.Id, Path = p.Url }; }, Log)); }
public JsonResponse <Unit> Update([JsonRequestBodyAttribute] JS.Page page) { return(JsonResponse.Catch(() => { var p = Pages.All.FirstOrDefault(x => x.Id == page.Id && x.SiteId == Sites.CurrentSiteId); if (p == null) { return JsonResponse <Unit> .NotFound; } p.Url = page.Path; p.Modified = DateTime.Now; UnitOfWork.Commit(); return JsonResponse <Unit> .Void; }, Log)); }