public ActionResult <TodoItemVm> GetById(int userId, int todoListId, int todoItemId) { var todoItem = _todoItemService.Get(userId, todoListId, todoItemId); if (todoItem == null) { return(NotFound()); } return(_mapper.Map <TodoItemVm>(todoItem)); }
public async Task <IBaseCommandResult> HandleGet(long id) { var todoItem = await _todoItemService.Get(id); if (todoItem == null) { return(new BaseCommandResult(false, "TodoItem not found", null)); } // MAPPING AND RETURN RESULT return(new BaseCommandResult(true, "TodoItem get with Success!", ItemToDto(todoItem))); }
public void GetByInvalidId() { Setup(); //Arrange var list = TodoListMock.GetEmptyList(); _repositoryMock.Setup(item => item.GetById(It.IsAny <int>())).ReturnsAsync(() => null); //Act var result = _todoItemService.Get(1).Result; //Assert _repositoryMock.Verify(item => item.GetById(1), Times.Once); Assert.Null(result); }
public async Task <ActionResult <TodoItem> > GetTodoItem(long id) { var todoItem = await _todoItemService.Get(id); if (todoItem == null) { return(NotFound()); } return(todoItem); }
public async Task <IActionResult> Edit(int id) { TodoItem todoItem = await _todoItemService.Get(id, User); if (todoItem == null) { TempData["ErrorMessage"] = "Item not found"; return(RedirectToAction("Error", "Home")); } var userTenant = User.GetTenantId(); // Acquiring token for graph in the signed-in users tenant, so it can be used to retrieve all the users from their tenant var graphAccessToken = await _tokenAcquisition.GetAccessTokenForUserAsync(new string[] { GraphScope.UserReadAll }, userTenant); TempData["UsersDropDown"] = (await _msGraphService.GetUsersAsync(graphAccessToken)) .Select(u => new SelectListItem { Text = u.UserPrincipalName, Value = u.Id }).ToList(); return(View(todoItem)); }
public async Task <TodoItem> GetById(int id) { return(await _todoItemService.Get(id)); }
public ActionResult <TodoItemRetrieve> Get(string id) { return(Ok(_itemService.Get(id))); }
// GET: api/User/5 public TodoItemViewModel Get(int id) { Mapper.CreateMap <TodoItemDTO, TodoItemViewModel>(); return(Mapper.Map <TodoItemDTO, TodoItemViewModel>(itemService.Get(id))); }
public ActionResult <IEnumerable <TodoItem> > Get() { return(Ok(_todoItemService.Get())); }
public IActionResult Get(int id) { return(Ok(_service.Get(id))); }