public void Get_existing_appointment_for_doctor() { var doctor = DatabaseContext.Doctors[0]; Appointment app = new Appointment() { Doctor = doctor, Patient = DatabaseContext.Patients[0], Date = DateTime.Now }; _appointmentService.AddAppointment(app); var appointment = _appointmentService.GetDoctorAppointments(doctor.Id); Assert.IsNotNull(appointment); }
public async Task <ActionResult <Appointment> > PostAppointment(Appointment appointment) { try { await _appointmentService.AddAppointment(appointment); } catch (AppointmentIdsDoNotMatchException e) { return(Conflict(e)); } catch (UserDoesNotExistException e) { return(BadRequest(e)); } catch (UserIsNotATherapistException e) { return(BadRequest(e)); } catch (AppointmentCannotEndBeforeStartTimeException e) { return(BadRequest(e)); } catch (AppointmentDoesNotExistException e) { return(BadRequest(e)); } return(CreatedAtAction("GetAppointment", new { id = appointment.AppointmentId }, appointment)); }
public IActionResult InsertAppointment([FromBody] InsertAppointmentRequestDto request) { int recordId = 0; try { var identity = HttpContext.User.Identity as ClaimsIdentity; IEnumerable <Claim> claims = identity?.Claims; var profileClaim = claims?.FirstOrDefault(x => x.Type == ClaimTypes.Name); if (profileClaim != null && int.TryParse(profileClaim.Value, out var profileId)) { var profile = profileService.GetProfileById(profileId); request.ProfileId = profile?.Id; } recordId = appointmentService.AddAppointment(request); } catch (Exception e) { Console.WriteLine(e); throw; } return(Ok(recordId)); }
private void AddAppointmentClick(object args) { AppointmentCreatedEventArgs appCreatedEventArgs = (AppointmentCreatedEventArgs)args; _appointmentService.AddAppointment(appCreatedEventArgs.CreatedAppointment.Subject, appCreatedEventArgs.CreatedAppointment.Start, appCreatedEventArgs.CreatedAppointment.End, "405"); }
public async void CreateAppointment(Appointment appointment) { await _appointmentService.Initialize(); List <Appointment> id = await _appointmentService.GetAppointment(); appointment.Id = "" + id.Count; await _appointmentService.AddAppointment(appointment); }
public IHttpActionResult AddAppointment([FromBody] AppointmentDTO appointmentDTO) { if (appointmentDTO == null) { return(BadRequest()); } var results = _appointmentService.AddAppointment(appointmentDTO); return(Ok(results)); }
public async Task <ActionResult> AddAppointment([FromBody] AppointmentManageItemModel model) => await Exec(async operation => { // VerifyUser(UserRole.Client); if (!ModelState.IsValid) { throw new Exception(ExceptionMessage.ModelIsInvalid); } var entity = model.ToEntity(); await appointmentService.AddAppointment(operation, entity); });
public ActionResult AddAppointment(AppointmentViewModel appointment) { try { isSuccess = appointmentService.AddAppointment(appointment); } catch (Exception ex) { logger.Error(ex, "Something bad happened"); } return(Json(new { success = isSuccess, message = "Added successfully!" }, JsonRequestBehavior.AllowGet)); }
public async Task <IActionResult> Post([FromBody] AppointmentModel model) { try { await _appointmentService.AddAppointment(model); return(Ok()); } catch (Exception ex) { return(CreateApiException(ex)); } }
private void OnAddApointmentEventRaised(object sender, EventArgs e) { Telerik.WinControls.UI.AppointmentAddedEventArgs args = (Telerik.WinControls.UI.AppointmentAddedEventArgs)e; try { _appointmentService.AddAppointment(args.Appointment.Summary, args.Appointment.Start, args.Appointment.End, args.Appointment.Location); } catch (ArgumentNullException) { _errorMessageView.ShowErrorMessageView("Error", "Discipline name doesn't exist. Please write discipline name as first word in appointment summary."); } }
public IHttpActionResult AddAppointment(AppointmentAdd appointment) { var result = _appointmentService.AddAppointment(appointment); switch (result.Outcome) { case OperationAddResult.AppointmentOperation.CenterDoesNotExist: return(BadRequest(ErrorMsgCenterDoesNotExist)); case OperationAddResult.AppointmentOperation.CenterAccommodationFull: return(Content(HttpStatusCode.Conflict, appointment)); case OperationAddResult.AppointmentOperation.AppointmentCreated: return(CreatedAtRoute("DefaultApi", new { id = result.Appointment.Id }, result.Appointment)); //todo fix the create at route default: throw new ArgumentOutOfRangeException(); } }
public ActionResult CreateAppointment(AppointmentViewModel appointment) { appointment.AppointmentCreationDate = DateTime.Now; appointment.AppointmentUpdateDate = DateTime.Now; //add var model = new Appointment(); model.AppointmentCreationDate = appointment.AppointmentCreationDate; model.CarId = appointment.CarId; model.AppointmentDate = appointment.AppointmentDate; model.AppointmentDescription = appointment.AppointmentDescription; model.AppointmentUpdateDate = appointment.AppointmentUpdateDate; _appointmentService.AddAppointment(model); return(RedirectToAction("GetListAppointmentByCustomerId", new RouteValueDictionary( new { controller = "Appointments", action = "GetListAppointmentByCustomerId", Id = appointment.CustomerId }))); }
public async Task <IHttpActionResult> AddApointment([FromBody] NewAppointment appointment) { try { var newAppointment = await _appointmentService.AddAppointment(appointment); if (newAppointment != null) { return(Ok()); } else { return(NotFound()); } } catch (Exception ex) { return(Content(HttpStatusCode.InternalServerError, "Unexpected error")); } }
public IActionResult Create(AppointmentModel model) { if (ModelState.IsValid) { Appointment appointment = _mapper.Map <Appointment>(model); int Id = _appointmentService.AddAppointment(appointment); if (Id > 0) { return(RedirectToAction("Index")); } else { return(View(model)); } } else { ModelState.AddModelError("", "Invalid data"); return(View(model)); } }
public async Task <object> CreateAppointment(RegisterAppointmentModel model) { try { if (await _appService.IsAppointmentExist(model)) { return(BadRequest(new { message = "Appointment is already exist" })); } var newApp = await _appService.AddAppointment(model); if (newApp != null) { return(Ok(newApp)); } return(BadRequest(new { message = "Operation failed, servers are down at the moment" })); } catch (Exception e) { return(BadRequest(new { e.Message })); } }
public JsonResult CreateAppointment(AppointmentVM appointmentVM) { appointmentService.AddAppointment(MapperUtilVM.MapToAppointmentDTO(appointmentVM)); return(Json(appointmentVM, JsonRequestBehavior.AllowGet)); }
public IActionResult AddEvent([FromBody] AddEventRequest request) { return(Ok(_appointmentService.AddAppointment(request))); }
public IActionResult AddAppointment(AppointmentDto dto) { appointmentService.AddAppointment(dto); return(RedirectToAction("Index")); }
public IActionResult AddAppointment([FromBody] AddAppointmentDto appointment) { _appointmentService.AddAppointment(appointment); return(Json(JsonResultData.Success())); }
public async Task <IActionResult> Post([FromBody] AddAppointmentDto appointment) { await _appointmentService.AddAppointment(appointment); return(Created("/appointment", null)); }
/// <summary> /// Adds the appointment /// </summary> /// <param name="appointment">appointment</param> /// <returns></returns> public Response <AppointmentModel> AddAppointment(AppointmentModel appointment) { return(appointmentService.AddAppointment(appointment)); }
public void RegistraCita(Appointment appointment) { _service.AddAppointment(appointment); }
public async Task <Appointment> AddAppointment(NewAppointment appointment) { return(await appointmentService.AddAppointment(appointment)); }
public async Task <ActionResult <int> > Post([FromBody] Appointment appointment) { return(await _appointmentService.AddAppointment(appointment)); }
public async Task <JsonResult> Post(ServiceLocationAppointmentViewModel entity) { return(Json(await _service.AddAppointment(entity))); }