Exemple #1
0
        public IActionResult Put([FromRoute] int userListId, [FromBody] UserListModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            if (!_userListRepository.Find(x => x.UserId == UserId && x.UserListId == model.UserListId).Any())
            {
                return(Forbid());
            }

            var userList = _mapper.Map <DataAccess.Tables.UserList>(model);

            userList.UserId = UserId;

            var result = _userListRepository.Update(userList);

            return(Ok(_mapper.Map <UserListModel>(result)));
        }
 public UserList Find(int?id)
 {
     return(_userListRepository.Find(id));
 }