private UserViewModel Map(DomainModel.User user) { return(new UserViewModel { Id = user.Id, Name = $"{user.FirstName} {user.LastName}", Location = user.Location, Status = user.Status, IsBench = user.IsBench, LastUpdatedUtc = user.LastUpdatedUtc }); }
private void AddUser(AppModel.User user) { if (user == null) { throw new ArgumentNullException(nameof(user)); } if (string.IsNullOrWhiteSpace(user.FirstName) || string.IsNullOrWhiteSpace(user.LastName)) { throw new InvalidDataException("First and Last Name are Required"); } DomainModel.User domainUser = new DomainModel.User(Guid.NewGuid()); domainUser.FirstName = user.FirstName; domainUser.LastName = user.LastName; domainUser.Location = user.Location; domainUser.Status = user.Status; domainUser.IsBench = user.IsBench; domainUser.LastUpdatedUtc = DateTime.UtcNow; this._userRepository.Add(domainUser); }