public async Task <int> AddAsync(CreateContactRecordInput input) { var existContactRecord = await _contactRecordRepository.GetByEmailAsync(input.Email); //TO-DO: Create own Exception if (existContactRecord != null) { throw new ContactRecordExistsException("ContactRecord alerady exists"); } //TO-DO: Use Automapper var address = new Core.ValueObjects.Address(input.Address.State, input.Address.City, input.Address.ZipCode, input.Address.Street, input.Address.Number); var phoneNumber = new Core.ValueObjects.PhoneNumber(input.PhoneNumber.PersonalNumber, input.PhoneNumber.WorkNumber); var contactRecord = new Core.Entities.ContactRecord(input.Name, input.Company, input.ProfileImagePath, input.Email, input.BirthDate, phoneNumber, address); await _contactRecordRepository.AddAsync(contactRecord); return(await _contactRecordRepository.UnitOfWork.SaveChangesAsync()); }
public void Update(Core.Entities.ContactRecord contactRecord) { _context.ContactRecord.Update(contactRecord); }
public void Delete(Core.Entities.ContactRecord contactRecord) { _context.ContactRecord.Remove(contactRecord); }
public async Task AddAsync(Core.Entities.ContactRecord contactRecord) { await _context.ContactRecord.AddAsync(contactRecord); }