public MvcTaskManager.Models.TaskStatus Post([FromBody] MvcTaskManager.Models.TaskStatus taskStatus) { db.TaskStatuses.Add(taskStatus); db.SaveChanges(); MvcTaskManager.Models.TaskStatus existingTaskPriority = db.TaskStatuses.Where(temp => temp.TaskStatusID == taskStatus.TaskStatusID).FirstOrDefault(); return(taskStatus); }
public IActionResult GetByTaskStatusID(int TaskStatusID) { MvcTaskManager.Models.TaskStatus taskStatuses = db.TaskStatuses.Where(temp => temp.TaskStatusID == TaskStatusID).FirstOrDefault(); if (taskStatuses != null) { return(Ok(taskStatuses)); } else { return(NoContent()); } }
public int Delete(int TaskStatusID) { MvcTaskManager.Models.TaskStatus existingTaskPriority = db.TaskStatuses.Where(temp => temp.TaskStatusID == TaskStatusID).FirstOrDefault(); if (existingTaskPriority != null) { db.TaskStatuses.Remove(existingTaskPriority); db.SaveChanges(); return(TaskStatusID); } else { return(-1); } }
public MvcTaskManager.Models.TaskStatus Put([FromBody] MvcTaskManager.Models.TaskStatus taskStatus) { MvcTaskManager.Models.TaskStatus existingTaskPriority = db.TaskStatuses.Where(temp => temp.TaskStatusID == taskStatus.TaskStatusID).FirstOrDefault(); if (existingTaskPriority != null) { existingTaskPriority.TaskStatusName = taskStatus.TaskStatusName; db.SaveChanges(); return(existingTaskPriority); } else { return(null); } }