public static UserDto UserToUserDto(User user) { UserDto userDto = Mapper.Map <User, UserDto>(user); userDto.UserWithUserGroups.Clear(); foreach (UserGroup userGroup in user.UserWithUserGroups) { UserGroupDto ugDto; if (userGroup.UserGroupId != 0) { UserGroupService ugService = new UserGroupService(); ugDto = ugService.GetById(userGroup.UserGroupId); } else { ugDto = UserGroup.UserGroupToUserGroupDto(userGroup); } userDto.UserWithUserGroups.Add(ugDto); } //districtDto.StateOfDistrict = State. return(userDto); }
public virtual void GetUserGroupById() { CreateUserGroup(); var id = UserGroupInstance.UserGroupId; var result = UserGroupService.GetById(id); Assert.AreEqual(id, result.UserGroupId, "incorrect User Group id was found"); Assert.AreEqual(UserGroupInstance.UserGroupName, result.UserGroupName, "Incorrect user group name was found"); Assert.AreEqual("Data Entry Operator Group", result.UserGroupName, "Incorrect user group name was returned"); }