Ejemplo n.º 1
0
        public JsonResult PostData(ServiceType serviceType)
        {
            ServiceType dataServiceType = new ServiceType();

            dataServiceType.Name = serviceType.Name;

            if (serviceType.Id > 0)
            {
                dataServiceType.Id = serviceType.Id;
                db.Update(dataServiceType);
            }
            else
            {
                db.Add(dataServiceType);
            }

            return(Json("success", JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
 public AddServiceTypeResponse Add(AddServiceTypeRequest request)
 {
     try
     {
         var response = new AddServiceTypeResponse();
         var bc       = new ServiceTypeComponent();
         response.Result = bc.Add(request.ServiceType);
         return(response);
     }
     catch (Exception ex)
     {
         var httpError = new HttpResponseMessage()
         {
             StatusCode   = (HttpStatusCode)422,
             ReasonPhrase = ex.Message
         };
         throw new HttpResponseException(httpError);
     }
 }