コード例 #1
0
        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);
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        private void AddAppointmentClick(object args)
        {
            AppointmentCreatedEventArgs appCreatedEventArgs = (AppointmentCreatedEventArgs)args;

            _appointmentService.AddAppointment(appCreatedEventArgs.CreatedAppointment.Subject,
                                               appCreatedEventArgs.CreatedAppointment.Start,
                                               appCreatedEventArgs.CreatedAppointment.End,
                                               "405");
        }
コード例 #5
0
        public async void CreateAppointment(Appointment appointment)
        {
            await _appointmentService.Initialize();

            List <Appointment> id = await _appointmentService.GetAppointment();

            appointment.Id = "" + id.Count;
            await _appointmentService.AddAppointment(appointment);
        }
コード例 #6
0
        public IHttpActionResult AddAppointment([FromBody] AppointmentDTO appointmentDTO)
        {
            if (appointmentDTO == null)
            {
                return(BadRequest());
            }
            var results = _appointmentService.AddAppointment(appointmentDTO);

            return(Ok(results));
        }
コード例 #7
0
 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);
 });
コード例 #8
0
 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));
 }
コード例 #9
0
        public async Task <IActionResult> Post([FromBody] AppointmentModel model)
        {
            try
            {
                await _appointmentService.AddAppointment(model);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(CreateApiException(ex));
            }
        }
コード例 #10
0
        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.");
            }
        }
コード例 #11
0
        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();
            }
        }
コード例 #12
0
        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 })));
        }
コード例 #13
0
        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"));
            }
        }
コード例 #14
0
 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));
     }
 }
コード例 #15
0
        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 }));
            }
        }
コード例 #16
0
 public JsonResult CreateAppointment(AppointmentVM appointmentVM)
 {
     appointmentService.AddAppointment(MapperUtilVM.MapToAppointmentDTO(appointmentVM));
     return(Json(appointmentVM, JsonRequestBehavior.AllowGet));
 }
コード例 #17
0
 public IActionResult AddEvent([FromBody] AddEventRequest request)
 {
     return(Ok(_appointmentService.AddAppointment(request)));
 }
コード例 #18
0
        public IActionResult AddAppointment(AppointmentDto dto)
        {
            appointmentService.AddAppointment(dto);

            return(RedirectToAction("Index"));
        }
 public IActionResult AddAppointment([FromBody] AddAppointmentDto appointment)
 {
     _appointmentService.AddAppointment(appointment);
     return(Json(JsonResultData.Success()));
 }
コード例 #20
0
        public async Task <IActionResult> Post([FromBody] AddAppointmentDto appointment)
        {
            await _appointmentService.AddAppointment(appointment);

            return(Created("/appointment", null));
        }
コード例 #21
0
 /// <summary>
 /// Adds the appointment
 /// </summary>
 /// <param name="appointment">appointment</param>
 /// <returns></returns>
 public Response <AppointmentModel> AddAppointment(AppointmentModel appointment)
 {
     return(appointmentService.AddAppointment(appointment));
 }
コード例 #22
0
 public void RegistraCita(Appointment appointment)
 {
     _service.AddAppointment(appointment);
 }
コード例 #23
0
 public async Task <Appointment> AddAppointment(NewAppointment appointment)
 {
     return(await appointmentService.AddAppointment(appointment));
 }
コード例 #24
0
 public async Task <ActionResult <int> > Post([FromBody] Appointment appointment)
 {
     return(await _appointmentService.AddAppointment(appointment));
 }
コード例 #25
0
 public async Task <JsonResult> Post(ServiceLocationAppointmentViewModel entity)
 {
     return(Json(await _service.AddAppointment(entity)));
 }