public async Task <ActionResult <TodoList> > PostTodoList(TodoListDTO todoListDTO) { var todoList = _mapper.Map <TodoListDTO, TodoList>(todoListDTO); if (todoList.Description == null) { return(BadRequest(new { message = "TodoList Description mandatory" })); } await _todoListService.CreateTodoList(todoList); return(CreatedAtAction("GetTodoList", new { id = todoList.Id }, todoList)); }
public async Task <IActionResult> Post([FromBody] TodoListRequest todoListDto) { var user = await _userManager.FindByNameAsync(User.Identity.Name); var todoList = new TodoList { Name = todoListDto.Name, Created = DateTime.UtcNow, User = user }; await _todoListService.CreateTodoList(todoList); return(Ok(todoListDto.Name)); }
public void CreateTodoList([FromBody] TodoListViewModel todoList) { todoList.ApplicationUserEntityId = User.Identity.GetUserId(); _todoListService.CreateTodoList(_mapper.Map <TodoListViewModel, TodoListDTO>(todoList)); }
public async Task <TodoList> AddTodoList(TodoListDTO todoList) { var todoListInput = _mapper.Map <TodoListDTO, TodoList>(todoList); return(await _todoListService.CreateTodoList(todoListInput)); }
public IActionResult CreateTodoList(TodoListDto requestModel) { requestModel.OwnerId = int.Parse(_httpContextAccessor.HttpContext.User.Identity.Name); _ = _todoListService.CreateTodoList(requestModel); return(CreatedAtRoute("GetTodoListById", new { id = requestModel.Id }, requestModel)); }