public bool DeleteById(int id) { try { var element = context.UserTasks.Single(x => x.Task_ID == id); context.UserTasks.Remove(element); context.SaveChanges(); return(true); } catch (Exception ex) { throw ex.InnerException; } }
public bool Insert(UsersModel record) { try { Users user = new Users(); if (record.User_Id > 0 && record.User_Id != null) { context.Users.Find(record.User_Id).FirstName = record.FirstName; context.Users.Find(record.User_Id).LastName = record.LastName; context.SaveChanges(); return(true); } user.FirstName = record.FirstName; user.LastName = record.LastName; user.Employee_Id = record.Employee_Id; context.Users.Add(user); context.SaveChanges(); return(true); } catch (Exception ex) { throw ex.InnerException; } }
public bool AddProjectDetails(ProjectModel projectModel) { try { Projects project = new Projects(); project.Project = projectModel.Project; project.Priority = projectModel.Priority; project.StartDate = projectModel.StartDate; project.Manager = projectModel.Manager; project.EndDate = projectModel.EndDate; context.Projects.Add(project); context.SaveChanges(); return(true); } catch (Exception) { return(false); throw; } }