public LogicResult <UserDTO> GetById(Guid id)
 {
     try
     {
         var entity = _userBusinessLogic.GetById(id);
         return(LogicResult <UserDTO> .Succeed(entity));
     }
     catch (Exception exception)
     {
         return(LogicResult <UserDTO> .Failure(exception));
     }
 }
        public ActionResult <User> GetUser(int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                var user = mapper.Map <UserDTO>(userBusinessLogic.GetById(id));
                return(Ok(user));
            }
            catch (UserDoesNotExistException e)
            {
                return(NotFound(e.Message));
            }
            catch (Exception e)
            {
                return(StatusCode(500, e.Message));
            }
        }
Пример #3
0
        public void GetUserByIdTest()
        {
            var user = userBLWithoutTeamBL.GetById(userWithAllData.Id);

            mockUserRepo.Verify(x => x.GetById(It.IsAny <int>()), Times.AtLeastOnce);
        }