Пример #1
0
        [HttpGet] // attribute for the GET
        public ActionResult Create()
        {
            TodoCreateVm model = new TodoCreateVm();

            model.Greeting = "Hello from Create Todo";
            return(View(model));
        }
        public IActionResult Post([FromBody] TodoCreateVm todo)
        {
            var result = new Todo(todo.Description);

            _repository.Add(result);

            return(CreatedAtAction(nameof(TodoController.Get), new { id = result.Id }, TodoDisplayVm.FromTodo(result)));
        }
Пример #3
0
        [HttpPost] // attribute for POST/CREATE
        public ActionResult Create(TodoCreateVm cVm)
        {
            int myResults = _service.CreateTodo(cVm.Task);

            return(RedirectToAction("Index"));
        }