Example #1
0
        // 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));
        }
Example #2
0
        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"));
            }
        }
Example #3
0
        public bool CreateToDo([FromBody] CreateToDo c)
        {
            bool isCreated = _manager.CreateToDo(c.userId, c.toDo);

            return(isCreated);
        }