public async Task <PartnerProfileResponse> SaveAsync(PartnerProfile partnerProfile) { try { await _partnerProfileRepository.AddAsync(partnerProfile); await _unitOfWork.CompleteAsync(); return(new PartnerProfileResponse(partnerProfile)); } catch (Exception ex) { return(new PartnerProfileResponse($"An error ocurred while saving the partner profila: {ex.Message}")); } }
public async Task <PartnerProfileResponse> UpdateAsync(int id, PartnerProfile partnerProfile) { var existingPartnerProfile = await _partnerProfileRepository.FindById(id); if (existingPartnerProfile == null) { return(new PartnerProfileResponse("Partner Profile not found")); } existingPartnerProfile.Address = partnerProfile.Address; existingPartnerProfile.Name = partnerProfile.Name; existingPartnerProfile.Telephone = partnerProfile.Telephone; try { _partnerProfileRepository.Update(existingPartnerProfile); await _unitOfWork.CompleteAsync(); return(new PartnerProfileResponse(existingPartnerProfile)); } catch (Exception ex) { return(new PartnerProfileResponse($"An error ocurred while updating the partner profile: {ex.Message}")); } }
public void Remove(PartnerProfile partnerProfile) { _context.PartnerProfiles.Remove(partnerProfile); }
public void Update(PartnerProfile partnerProfile) { _context.PartnerProfiles.Update(partnerProfile); }
public async Task AddAsync(PartnerProfile partnerProfile) { await _context.PartnerProfiles.AddAsync(partnerProfile); }