public virtual ActionResult Create(NewPageResponse info) { if (ModelState.IsValid) { _PageService.CreatePage(info); return new EntityResult(MVC.Admin.Pages.Index(), string.Format("Page '{0}' added.", info.Title)); } return new Http400Result(ModelState); }
/// <summary> /// Creates a new page. /// </summary> /// <param name="info"></param> public void CreatePage(NewPageResponse info) { using (var db = new Entities()) { var page = Mapper.Map<Page>(info); page.CreatedAt = DateTime.Now; db.Pages.Add(page); db.SaveChanges(); } }