Exemple #1
0
        public UserContractUpdatedReturnDto ChangeUserContract(int userId, int newContractId)
        {
            if (!_userOperations.UserExists(userId) || !_contractOperations.ContractExists(newContractId))
            {
                return(null);
            }
            var user     = _userOperations.GetUserById(userId);
            var contract = _contractOperations.GetContractById(newContractId);

            if (contract.HasAssociatedUser())
            {
                return(null);
            }
            var updatedUser = _userOperations.ChangeUserContract(user, contract);

            return(updatedUser == null ? null : Mapper.Map <UserContractUpdatedReturnDto>(updatedUser));
        }