public IHttpActionResult AddToDoItem(AddToDoItemModel item) { try { var username = HttpContext.Current.User.Identity.Name; var user = UserManager.FindByNameAsync(username).GetAwaiter().GetResult(); var itemId = _todoListService.AddToDoItem(item, user.Id); return(Ok(itemId)); } catch { return(InternalServerError()); } }
public async Task <IActionResult> Create(ToDoItemVm newToDoItem) { var result = await _toDoListService.AddToDoItem(newToDoItem); return(Ok(result)); }