// POST: api/ToDo public ToDo Post([FromBody] CreateToDo toDo) { ToDo td = new ToDo() { Title = toDo.Title, Description = toDo.Description, UserId = toDo.UserId }; return(_todoRepository.Insert(td)); }
public ActionResult Create(CreateToDo form) { try { if (ModelState.IsValid) { _toDoRepository.Insert(new ToDo(form.Title, form.Description, SessionManager.User.Id)); return(RedirectToAction("Index")); } return(View(form)); } catch { return(View("Error")); } }
public bool CreateToDo([FromBody] CreateToDo c) { bool isCreated = _manager.CreateToDo(c.userId, c.toDo); return(isCreated); }