public IActionResult AfterAdd(string newTodo) { todoService.AddNewTodo(new Todo() { Title = newTodo }); var todos = applicationContext.Todos.ToList(); return(RedirectToAction(nameof(Index), "Todo", todos)); }
public async Task <IActionResult> Post([FromBody] ToDo todo) { if (!ModelState.IsValid) { return(BadRequest(new ResponseMessage() { Status = false, Error = "مقادیر اشتباه است" })); } _todoService.AddNewTodo(todo); _todoService.Save(); return(Ok(new ResponseMessage() { Message = "با موفقیت ذخیره شد", Status = true })); }
public IActionResult AddTodo(Todo todo) { todoService.AddNewTodo(todo); return(Redirect("list")); }
public IActionResult AddNewTodo(Todo todo) { todoService.AddNewTodo(todo); return(RedirectToAction(actionName: nameof(Index))); }