예제 #1
0
 public void delete(UpdateDoctorRequest request)
 {
     try
     {
         var response = new UpdateDoctorResponse();
         var bc       = new DoctorComponent();
         bc.Update(request.Doctor);
     }
     catch (Exception ex)
     {
         var httpError = new HttpResponseMessage()
         {
             StatusCode   = (HttpStatusCode)422,
             ReasonPhrase = ex.Message
         };
         throw new HttpResponseException(httpError);
     }
 }
예제 #2
0
 public GetDoctorResponse getById(int id)
 {
     try
     {
         var response = new GetDoctorResponse();
         var bc       = new DoctorComponent();
         response.Result = bc.Find(id);
         return(response);
     }
     catch (Exception ex)
     {
         var httpError = new HttpResponseMessage()
         {
             StatusCode   = (HttpStatusCode)422,
             ReasonPhrase = ex.Message
         };
         throw new HttpResponseException(httpError);
     }
 }
예제 #3
0
 public AddDoctorResponse add(AddDoctorRequest request)
 {
     try
     {
         var response = new AddDoctorResponse();
         var bc       = new DoctorComponent();
         response.Result = bc.Add(request.Doctor);
         return(response);
     }
     catch (Exception ex)
     {
         var httpError = new HttpResponseMessage()
         {
             StatusCode   = (HttpStatusCode)422,
             ReasonPhrase = ex.Message
         };
         throw new HttpResponseException(httpError);
     }
 }
예제 #4
0
        public AllDoctorsResponse getAll()
        {
            try
            {
                var response = new AllDoctorsResponse();
                var bc       = new DoctorComponent();
                response.Result = bc.ToList();

                return(response);
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };
                throw new HttpResponseException(httpError);
            }
        }