Beispiel #1
0
        public async Task <ActionResult> AddAppointmentAsync(int userId, int vaccineId)
        {
            if (await _service.UserHasVaccine(userId, vaccineId))
            {
                return(BadRequest("You already have this vaccination or already have another appointment for it scheduled."));
            }
            try
            {
                await _service.AddAppointmentAsync(userId, vaccineId);

                return(Ok("Appointment Created"));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
Beispiel #2
0
        public async Task <IActionResult> Post([FromBody] CreatedAppointmentModel model)
        {
            var result = await _appointmentService.AddAppointmentAsync(UserId, _mapper.Map <CreatedAppointment>(model));

            return(Success(result));
        }