public async Task <ActionResult> Post(AppointmentResource appointment) { var result = await _apiCall.Create(appointment, Urls.BaseUrlCreateAppointment, Urls.UrlToBaseAppointment); if (result.IsSuccessStatusCode) { return(Ok()); } return(BadRequest()); }
public async Task <IActionResult> PutAppointment([FromRoute] int id, [FromBody] AppointmentResource appointmentResource) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != appointmentResource.Id) { return(BadRequest()); } var appointment = await repository.GetAppointmentAsync(id); // Kada zalimo da zakazemo pregled u neki slobodan termin if (appointmentResource.TimeId == 0) { appointment.PatientId = appointmentResource.PatientId; } // Kada zelimo da otkazemo dati pregled i ucinimo termin ponovo slobodnim if (appointmentResource.PatientId == 0) { appointment.PatientId = 0; } repository.UpdateAppointment(appointment); try { await unitOfWork.CompleteAsync(); } catch (DbUpdateConcurrencyException) { if (!AppointmentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public static AppointmentResource CreateAppointmentResource(int appointments_AppointmentID, int resources_ResourceID) { AppointmentResource appointmentResource = new AppointmentResource(); appointmentResource.Appointments_AppointmentID = appointments_AppointmentID; appointmentResource.Resources_ResourceID = resources_ResourceID; return appointmentResource; }
public void AddToAppointmentResources(AppointmentResource appointmentResource) { base.AddObject("AppointmentResources", appointmentResource); }