public int UpdatePartialPage(Models.PartialPageModel obj) { using (PhysioDevEntities db = new PhysioDevEntities()) { obj.UpdatedDate = DateTime.Now.Date; try { PartialPage partialPage = new PartialPage(); obj.CopyProperties(partialPage); db.Entry(partialPage).State = EntityState.Modified; db.SaveChanges(); return(1); } catch (Exception ex) { return(0); throw ex; } } }
public int AddPartialPage(Models.PartialPageModel obj) { obj.CreatedDate = DateTime.Now.Date; obj.UpdatedDate = DateTime.Now.Date; obj.IsActive = true; using (PhysioDevEntities db = new PhysioDevEntities()) { try { PartialPage partialpage = new PartialPage(); obj.CopyProperties(partialpage); db.PartialPages.Add(partialpage); db.SaveChanges(); return(1); } catch (DbEntityValidationException ex) { return(0); throw ex; } } }