public void Update(Task task)
 {
     using (var cnn = GetDbConnection())
     {
         SqlMapperExtensions.Update(cnn, task);
     }
 }
 public int Add(Task task)
 {
     using (var cnn = GetDbConnection())
     {
         return (int)cnn.Insert(task);
     }
 }
 public void Delete(Task task)
 {
     using (var cnn = GetDbConnection())
     {
         cnn.Delete(task);
     }
 }
        public ActionResult EditTask(int boardId, Task task)
        {
            if (Request["delete"] != null && Request["delete"] == "delete")
            {
                _taskRepository.Delete(task);
                return RedirectToAction("Index", new{id = boardId}).WithSuccess("Task Was Deleted");
            }

            if (!string.IsNullOrEmpty(task.Owner)) task.Owner = task.Owner.Trim();

            if (task.Id == 0)
            {
                task.ColumnId = _columnRepository.List(boardId).First().Id;
                _taskRepository.Add(task);
                return RedirectToAction("Index", new { id = boardId }).WithSuccess("Task Was Added");
            }

            _taskRepository.Update(task);
            return RedirectToAction("Index", new { id = boardId }).WithSuccess("Task Was Saved");
        }