public async Task <ActionResult <String> > AddPatientAddress(Address_dto address) { try { var Id = await _patientService.AddPatientAddress(address); return(Ok(Id)); } catch (Exception ex) { _logger.LogError(ex.Message); return(StatusCode(500)); } }
public async Task <bool> UpdatePatientAddress(Address_dto address_dto) { try { var Address = await _context.PatientAddresss.FindAsync(Guid.Parse(address_dto.Id)); Address = _mapper.Map <Address>(address_dto); Address.LastUpdate = DateTime.Now; var dbresponse = await _context.SaveChangesAsync(); return(dbresponse == 1); } catch (Exception ex) { _logger.LogError(ex.Message); throw; } }
public async Task <string> AddPatientAddress(Address_dto address) { try { address.Id = null; Address newPatientAddress = _mapper.Map <Address>(address); newPatientAddress.LastUpdate = DateTime.Now; _context.PatientAddresss.Add(newPatientAddress); await _context.SaveChangesAsync(); return(_uriService.GetPatientAddressUri(newPatientAddress.Id.ToString()).ToString()); } catch (Exception ex) { _logger.LogError(ex.Message); throw; } }
public async Task <ActionResult <String> > UpdatePatientAddress(Address_dto address) { try { var success = await _patientService.UpdatePatientAddress(address); if (success) { return(Ok()); } return(NotFound()); } catch (Exception ex) { _logger.LogError(ex.Message); return(StatusCode(500)); } }