public void CreateAppointmentSuccessfully() { var patient = new PatientDto { Name = "Felipe Cristo de Oliveira", BirthDate = new DateTime(1991, 2, 3) }; patient = _patientService.Create(patient); var appointment = new AppointmentDto { PatientId = patient.Id, StartedAt = new DateTime(2020, 04, 01, 15, 30, 0), FinishedAt = new DateTime(2020, 04, 01, 16, 0, 0), Comments = "Comment test" }; var appointmentCreated = _service.Create(appointment); Assert.NotEqual(0, appointmentCreated.Id); Assert.Equal(appointment.PatientId, appointmentCreated.PatientId); Assert.Equal(appointment.StartedAt, appointmentCreated.StartedAt); Assert.Equal(appointment.FinishedAt, appointmentCreated.FinishedAt); Assert.Equal(appointment.Comments, appointmentCreated.Comments); }
public void Create_ValidAppointment_True() { // there is an appointment for patient 1 in +2 days var appointment4 = new Appointment() { PatientId = 1, Date = DateTime.Now.AddDays(3), SpecialtyId = 1 }; var result = _appointmentService.Create(appointment4); // can be created, because there is no appointment in +3 days Assert.IsTrue(result); }
private void Randevu(object sender, EventArgs e) { Button current = (Button)sender; string message = String.Format( "RANDEVUNUZ \n" + "Hastane:{6}\nPoliklinik: {0}\nDoktor: {1} {2}\nSaat: {3}\nAdınız Soyadınız: {4} {5}" + " onaylıyorsanız Evet'e basınız." , CPoliclinic.Unit.Name, CDoctor.Name, CDoctor.Surname, current.Text, patient.Name, patient.Surname, CHospital.Name ); string title = "Randevu Kontrol"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result = MaterialMessageBox.Show(message, title, buttons); if (result == DialogResult.Yes) { Appointment appointment = new Appointment { PatientId = patient.Id, DoctorId = CDoctor.Id, PoliclinicId = CPoliclinic.Id, Hour = TimeSpan.Parse(current.Text), Date = dateTimePicker2.Value }; appointmentService.Create(appointment); AppointmentHours(dateTimePicker2.Value, CDoctor.Id); AppointmentBind(); } else { } }
public HttpResponseMessage Create(AppointmentDto appoinDto) { if (appoinDto.PatientId != null) { appoinDto.PatientId = appoinDto.PatientId; } // call to AppointmentService var result = _appointmentService.Create(appoinDto); // push noti if (result.Success) { var tokens = _tokenService.GetAll(); int[] roleIds = { (int)RoleEnum.Receptionist, (int)RoleEnum.Cashier, (int)RoleEnum.Manager }; var data = new { roleIds, message = "Có cuộc hẹn vừa được thêm." }; SendNotificationUtils.SendNotification(data, tokens); } var response = Request.CreateResponse(HttpStatusCode.OK, result); return(response); }
public IActionResult Create(AppointmentDTO dto) { if (ModelState.IsValid) { _appointmentService.Create(dto); } return(Ok()); }
public Response Post(Appointment appointment) { _appointmentService.Create(appointment); return(new Response { Body = "success" }); }
public async Task <IActionResult> Create(CreateAppointmentRequest request) { if (!ModelState.IsValid) { return(BadRequest(ModelState.ValidationState)); } var response = await _appointmentService.Create(request); return(Ok(response)); }
public ActionResult <CreateAppointmentDto> PostAppointment(CreateAppointmentDto appointment) { if (!ModelState.IsValid) { return(BadRequest()); } _service.Create(appointment); return(appointment); }
public async Task <ActionResult <AppointmentDto> > CreateAppointmentForClient([FromRoute] Guid clientId, [FromBody] AppointmentCDto appointment) { if (!await ClientExists(clientId)) { return(NotFound()); } var appointmentEntity = mapper.Map <Appointment>(appointment); var(appointmentIdReturn, _) = await appointmentService.Create(clientId, appointmentEntity); return(CreatedAtRoute("GetAppointmentForClient", new { clientId, appointmentId = appointmentIdReturn }, mapper.Map <AppointmentDto>(appointmentEntity))); }
public IActionResult Create(AppointmentDTO dto) { if (!IsValidAuthenticationRole("Patient")) { return(StatusCode(403)); } if (ModelState.IsValid) { _appointmentService.Create(dto); } return(Ok()); }
public async Task <ActionResult> Create([FromBody] AppointmentRequest model) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } return(Ok(await _appointmentService.Create(model))); } catch (Exception) { return(BadRequest()); } }
public ActionResult CreateAppointment(int patientId, int reservationId) { _appointmentService.Create(reservationId, patientId); var patient = _patientRepo.Get(patientId); var reservation = _reservationRepo.Get(reservationId); var time = _scheduleRepo.GetTime(reservation.DoctorAppointmentDateTimeId); var model = new AppointmentDetailsViewModel { Doctor = _doctorRepo.GetDoctorDetails(time.Schedule.DoctorId), Patient = patient, Date = time.Schedule.Date, Time = _scheduleService.FormatTime(time.Time) }; return(View(model)); }
public IActionResult CreateAppointment(AppointmentInputModel model) { if (!ModelState.IsValid) { return(this.View(model)); } if (model.AppointmentDate < DateTime.UtcNow) { return(this.View(model)); } if (model.AppointmentDate > DateTime.UtcNow.AddDays(10)) { return(this.View(model)); } var username = this.User.Identity.Name; var ad = adService.GetAd(model.AdId); var userProfile = profileService.GetUserByUsername(username); var agencyProfile = profileService.GetAgencyById(ad.AgencyProfileId); appointmentService.Create(ad, userProfile, agencyProfile, model.AppointmentDate); return(this.Redirect(GlobalConstants.homeUrl)); }
public AppointmentDto Create([FromBody] AppointmentDto data) { return(_service.Create(data)); }
public ActionResult AppointmentCreate([FromForm] AppointmentCO request) { var sonuc = new ResultDTO(); if (request.PetGuid == null && request.PetGuid == default(Guid)) { throw new PetClinicAppointmentBadRequestException("Pet guid cannot be empty!"); } if (request.AvailableAppointmentTimeGuid == null && request.AvailableAppointmentTimeGuid == default(Guid)) { throw new PetClinicAppointmentBadRequestException("Available appointment time guid cannot be empty!"); } var pet = _petService.GetByGuid(request.PetGuid); if (pet == null) { throw new PetClinicAppointmentNotFoundException("Pet not found!"); } var availableAppointment = _availableAppointmentService.GetByGuid(request.AvailableAppointmentTimeGuid); if (availableAppointment == null) { throw new PetClinicAppointmentNotFoundException("Admin has not created such an appointment time. Please send another appointment time!"); } var appointmentVarMi = _appointmentService.GetByAppointment(request.PetGuid, request.AvailableAppointmentTimeGuid); if (appointmentVarMi.Count > 0) { throw new PetClinicAppointmentBadRequestException("Such an appointment already exists!"); } var dto = new AppointmentDTO() { Guid = Guid.NewGuid(), Deleted = false, Actived = true, CreatedDate = DateTime.Now, AppointmentTime = availableAppointment.AppointmentTime, UserId = pet.UserId, PetId = pet.Id, Pet = null, User = null }; var durum = _appointmentService.Create(dto); if (durum > 0) { var appo = _appointmentService.GetById(durum); sonuc.Status = EDurum.SUCCESS; sonuc.Message.Add(new MessageDTO() { Code = HttpStatusCode.OK, Status = EDurum.SUCCESS, Description = "Appointment was created successfully." }); sonuc.Data = new { appointment = new { appo.Guid, appo.AppointmentTime, pet = new { appo.Pet.Guid, appo.Pet.Name, appo.Pet.DogumTarihi, appo.Pet.DogumYeri, owner = new { appo.User.Guid, appo.User.Name, appo.User.Surname, appo.User.Email } } } }; } else { throw new PetClinicAppointmentBadRequestException("Couldn't create an appointment!"); } return(Ok(sonuc)); }
public async Task <CalendarEntry> CreateAppointment(DateTime start, DateTime end, Doctor doctor, Patient patient, Room room) { return(await _appointmentService.Create(start, end, doctor, patient, room)); }
public async Task Create([FromBody] CreateAppointmentDto createAppointmentDto) { await _appointmentService.Create(createAppointmentDto); }
public bool Post([FromBody] Appointment value) { var result = _appointmentService.Create(value); return(result); }