public ActionResult <CitaResponse> Post(CitaRequest request)
        {
            CrearCitaService _service = new CrearCitaService(_unitOfWork);
            CitaResponse     response = _service.CrearCita(request);

            return(Ok(response));
        }
Ejemplo n.º 2
0
 public CitaResponse LeerPorId(int id)
 {
     try
     {
         var response = new CitaResponse();
         var bc       = new CitaComponent();
         response.Result = bc.Find(id);
         return(response);
     }
     catch (Exception ex)
     {
         var httpError = new HttpResponseMessage()
         {
             StatusCode   = (HttpStatusCode)422,
             ReasonPhrase = ex.Message
         };
         throw new HttpResponseException(httpError);
     }
 }
Ejemplo n.º 3
0
 public CitaResponse Agregar(CitaRequest request)
 {
     try
     {
         var response = new CitaResponse();
         var bc       = new CitaComponent();
         response.Result = bc.Add(request.Cita);
         return(response);
     }
     catch (Exception ex)
     {
         var httpError = new HttpResponseMessage()
         {
             StatusCode   = (HttpStatusCode)422,
             ReasonPhrase = ex.Message
         };
         throw new HttpResponseException(httpError);
     }
 }