/// <summary> /// Objednanie vyšetrenia na zadaný čas podľa id vyšetrenia /// </summary> /// <param name="objednanyCas"></param> /// <returns></returns> public async Task <ServiceResponse <GetVysetrenieDto> > SetAppointmentTime(SetTimeVysetrenieDto objednanyCas) { ServiceResponse <GetVysetrenieDto> serviceResponse = new ServiceResponse <GetVysetrenieDto>(); try { Vysetrenie vysetrenie = await _context.Vysetrenia.FindAsync(objednanyCas.VysetrenieId); vysetrenie.ObjednanyTermin = objednanyCas.DateTime; vysetrenie.ObjednanePacientom = true; await _context.SaveChangesAsync(); serviceResponse.Data = _mapper.Map <GetVysetrenieDto>(vysetrenie); serviceResponse.Success = true; } catch (Exception ex) { serviceResponse.Success = false; serviceResponse.Message = ex.Message; } return(serviceResponse); }
public async Task <ActionResult <GetVysetrenieDto> > SetAppointmentTime(SetTimeVysetrenieDto objednanyCas) { return(Ok(await _vysetreniaService.SetAppointmentTime(objednanyCas))); }