public void Delete(int id) { Core_DashboardContents result = ent.Core_DashboardContents.Where(x => x.DashboardContentId == id).FirstOrDefault(); ent.DeleteObject(result); ent.SaveChanges(); }
public DashboardContentsModel GetCMSContent(int id) { Core_DashboardContents result = ent.Core_DashboardContents.Where(x => x.DashboardContentId == id).FirstOrDefault(); string Contents = string.Empty; if (result != null) { DashboardContentsModel model = new DashboardContentsModel(); model.Body = ATLTravelPortal.Helpers.CMSContents.GetCMSContents(result.Body); return(model); } return(null); }
public int CreateDashBoardContents(DashboardContentsModel model) { Core_DashboardContents obj = new Core_DashboardContents(); obj.Title = model.Title; obj.Body = model.Body; obj.isPublished = model.IsPublished; obj.CreatedBy = model.CreatedBy; obj.CreatedDate = DateTime.Now; ent.AddToCore_DashboardContents(obj); ent.SaveChanges(); return(obj.DashboardContentId); }
public void EditDashBoardContents(DashboardContentsModel model) { Core_DashboardContents result = ent.Core_DashboardContents.Where(u => u.DashboardContentId == model.DasbBoardContentId).FirstOrDefault(); if (result != null) { result.Title = model.Title; result.Body = model.Body; result.isPublished = model.IsPublished; result.UpdatedBy = model.UpdatedBy; result.UpdatedDate = model.UpdatedDate; ent.ApplyCurrentValues(result.EntityKey.EntitySetName, result); ent.SaveChanges(); } }
public DashboardContentsModel GetDashboardContentsDetailByUserId(int Userid) { Core_DashboardContents result = ent.Core_DashboardContents.Where(x => x.CreatedBy == Userid).FirstOrDefault(); if (result != null) { DashboardContentsModel model = new DashboardContentsModel(); model.DasbBoardContentId = result.DashboardContentId; model.Title = result.Title; model.Body = result.Body; model.CreatedBy = result.CreatedBy; model.CreatedName = result.UsersDetails.FullName; model.CreatedDate = result.CreatedDate; model.UpdatedBy = result.UpdatedBy; model.UpdatedName = result.UsersDetails.FullName; model.UpdatedDate = result.UpdatedDate; return(model); } return(null); }