public static bool UpdateProjectDetail(ProjectDetail project) { bool status; using (var myContext = new ProjectManagementEntities()) { try { ProjectDetail projectItemInfo = myContext.ProjectDetails.Where(p => p.Id == project.Id).FirstOrDefault(); if (projectItemInfo != null) { projectItemInfo.Id = project.Id; projectItemInfo.ManagerId = project.ManagerId; projectItemInfo.Priority = project.Priority; projectItemInfo.ProjectDesc = project.ProjectDesc; projectItemInfo.StartDate = project.StartDate; projectItemInfo.EndDate = project.EndDate; projectItemInfo.StatusId = project.StatusId; myContext.SaveChanges(); } status = true; } catch (Exception) { status = false; } } return(status); }
public static bool InsertProjectDetail(ProjectDetail project) { bool status; project.StatusId = 1; using (var myContext = new ProjectManagementEntities()) { try { myContext.ProjectDetails.Add(project); myContext.SaveChanges(); status = true; } catch (Exception ex) { status = false; } } return(status); }
public static bool DeleteProject(int id) { bool status; using (var myContext = new ProjectManagementEntities()) { try { ProjectDetail prodItem = myContext.ProjectDetails.Where(p => p.Id == id).FirstOrDefault(); if (prodItem != null) { myContext.ProjectDetails.Remove(prodItem); myContext.SaveChanges(); } status = true; } catch (Exception) { status = false; } } return(status); }