public IComandResult Handle(UpdateCollaboratorComand comand) { var name = new Name(comand.FirstName, comand.LastName); var document = new Document(comand.Document); var email = new Email(comand.Email); var address = new Address(comand.Street, comand.Number, comand.District, comand.City, comand.Country, comand.ZipCode); var idAdd = _collaboratorRepository.Get(comand.Id).IdAddress; address.Id = idAdd; var phone = new Phone(comand.Phone); var collaborator = new Collaborator(name, document, email, phone, address, comand.Salary, comand.ProjectName, comand.BirthDate, comand.JobTitle) { Id = comand.Id }; AddNotifications(collaborator); AddNotifications(name); AddNotifications(document); AddNotifications(email); AddNotifications(address); AddNotifications(phone); if (IsInvalid()) { return(null); } _collaboratorRepository.Update(collaborator); return(new CreateCollaboratorCommandResult(collaborator.Id, name.ToString(), email.Address)); }
public GetCollaboratorDto GetById(Guid id) { return(_collaboratorRepository.Get(id)); }
public Collaborator GetCollaborator(string userId, string expenseStoryId) { return(collaboratorRepository.Get(c => c.UserId == userId && c.ExpenseStoryId == expenseStoryId)); }