public bool Create(TaskP task) { TeamUpContext dbTask = new TeamUpContext(); dbTask.Tasks.Add(task); dbTask.SaveChanges(); return(true); }
public void Update(TaskP task) { TeamUpContext dbTask = new TeamUpContext(); var taskDB = dbTask.Tasks.FirstOrDefault(x => x.TaskID == task.TaskID); taskDB.Name = task.Name; taskDB.DateClose = task.DateClose; taskDB.Description = task.Description; dbTask.SaveChanges(); }
public bool Edit(TaskModel tkM) { Mapping mapping = new Mapping(); TaskP taskE = new TaskP(); mapping.MapObjects(tkM, taskE); taskRepository.Update(taskE); return(true); }
public bool Create(TaskModel taskM) { TaskP entity = new TaskP(); Mapping mapping = new Mapping(); Account createAccount = new Account(); Project orginProject = new Project(); mapping.MapObjects(taskM, entity); entity.ProjectID = taskM.Project; entity.UserName = taskM.AccountCreator; return(taskRepository.Create(entity)); }
public TaskModel GetOne(int id) { TaskModel taskM = new TaskModel(); Mapping mapping = new Mapping(); TaskP taskDb = taskRepository.GetOne(id); if (taskDb != null) { mapping.MapObjects(taskDb, taskM); } taskM.AccountCreator = taskDb.UserName; taskM.Project = taskDb.ProjectID; return(taskM); }
public bool CloseOrOpen(int Id, bool CloseOrOpen) { TeamUpContext dbTask = new TeamUpContext(); TaskP task = new TaskP(); task = dbTask.Tasks.FirstOrDefault(x => x.TaskID == Id); if (task != null) { task.isClosed = CloseOrOpen; dbTask.SaveChanges(); return(true); } else { return(false); } }