/// <summary> /// Adds the specified task. /// </summary> /// <param name="task">The task.</param> /// <returns></returns> public tbl_Task Add(tbl_Task task) { task.ID = Guid.NewGuid(); _dataContext.tbl_Task.AddObject(task); _dataContext.SaveChanges(); return(task); }
public ActionResult DeleteConfirmed(int id) { tbl_Task tbl_task = db.tbl_Task.Find(id); db.tbl_Task.Remove(tbl_task); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Delete(int id = 0) { tbl_Task tbl_task = db.tbl_Task.Find(id); if (tbl_task == null) { return(HttpNotFound()); } return(View(tbl_task)); }
public ActionResult Edit(tbl_Task tbl_task) { if (ModelState.IsValid) { db.Entry(tbl_task).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbl_task)); }
public TaskVM GetTaskInfoById(int id) { TaskVM dto = new TaskVM(); tbl_Task objTask = entDB.tbl_Task.Find(id); dto.Id = objTask.Id; dto.TaskName = objTask.TaskName; return(dto); }
// PUT: api/Tasks/5 public bool Put(tbl_Task task) { try { return(unitOfWork.TaskManager.UpdateEntity(task)); } catch { return(false); } }
public ActionResult Create(tbl_Task tbl_task) { if (ModelState.IsValid) { db.tbl_Task.Add(tbl_task); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbl_task)); }
// POST: api/Tasks public bool Post(tbl_Task task) { var id = unitOfWork.TaskManager.MaxId(task); for (int i = 0; true; i++) { if (unitOfWork.TaskManager.GetByID(id) == null) { task.id = id; return(unitOfWork.TaskManager.AddEntity(task)); } id++; } }
public bool DeleteTaskInfo(int id) { bool isDeleted = false; try { tbl_Task objTask = entDB.tbl_Task.Find(id); entDB.tbl_Task.Remove(objTask); entDB.SaveChanges(); isDeleted = true; } catch { return(false); } return(isDeleted); }
public bool UpdateTaskInfo(TaskVM dtoTask) { bool isSaved = false; try { tbl_Task objTask = new tbl_Task(); objTask.Id = dtoTask.Id; objTask.TaskName = dtoTask.TaskName; entDB.Entry(objTask).State = EntityState.Modified; entDB.SaveChanges(); isSaved = true; } catch { return(false); } return(isSaved); }
public bool CreateTaskInfo(TaskVM dtoTask) { bool isSaved = false; try { tbl_Task objTask = new tbl_Task(); objTask.TaskName = dtoTask.TaskName; entDB.tbl_Task.Add(objTask); entDB.SaveChanges(); isSaved = true; } catch { return(false); } return(isSaved); }
/// <summary> /// Updates the specified task. /// </summary> /// <param name="task">The task.</param> public void Update(tbl_Task task) { _dataContext.SaveChanges(); }
// PUT: api/Tasks/5 public bool Put(tbl_Task task) { return(unitOfWork.TaskManager.UpdateEntity(task)); }