public HttpResponseMessage Post(Cantidad_fraccion_platillos varCantidad_fraccion_platillos) { if (ModelState.IsValid) { var data = "-1"; try { data = Convert.ToString(this.service.Insert(varCantidad_fraccion_platillos)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_InsCantidad_fraccion_platillos", new JavaScriptSerializer().Serialize(varCantidad_fraccion_platillos), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_InsCantidad_fraccion_platillos", new JavaScriptSerializer().Serialize(varCantidad_fraccion_platillos), true); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } return(Request.CreateResponse(HttpStatusCode.OK, data, Configuration.Formatters.JsonFormatter)); } else { var errors = ModelState.SelectMany(m => m.Value.Errors.Select(err => err.ErrorMessage != string.Empty ? err.ErrorMessage : err.Exception.Message).ToList()).ToList(); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_InsCantidad_fraccion_platillos", new JavaScriptSerializer().Serialize(varCantidad_fraccion_platillos), false, errors.ToString()); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.BadRequest, errors)); } }
public HttpResponseMessage Delete(int id) { Cantidad_fraccion_platillos varCantidad_fraccion_platillos = this.service.GetByKey(id, false); bool result = false; if (varCantidad_fraccion_platillos == null) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } try { result = this.service.Delete(id);//, globalData, dataReference); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, id, BitacoraHelper.TypeSql.DELETE, "sp_DelCantidad_fraccion_platillos", new JavaScriptSerializer().Serialize(varCantidad_fraccion_platillos), result); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, id, BitacoraHelper.TypeSql.DELETE, "sp_DelCantidad_fraccion_platillos", new JavaScriptSerializer().Serialize(varCantidad_fraccion_platillos), result, ex.Message); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } return(Request.CreateResponse(HttpStatusCode.OK, result)); }
public HttpResponseMessage Get_Datos_Generales(int id) { Cantidad_fraccion_platillos entity = this.service.ListaSelAll(1, 1, "Cantidad_fraccion_platillos.Folio='" + id.ToString() + "'", "").Cantidad_fraccion_platilloss.First(); Cantidad_fraccion_platillos result = new Cantidad_fraccion_platillos(); result.Folio = entity.Folio; result.Cantidad = entity.Cantidad; return(Request.CreateResponse(HttpStatusCode.OK, result, Configuration.Formatters.JsonFormatter)); }
public HttpResponseMessage PutTunnel(Cantidad_fraccion_platillos emp, string user, string password) { var client = new System.Net.WebClient(); client.Headers = TokenManager.GetAuthenticationHeader(user, password); client.Headers["Content-Type"] = "application/json"; var dataString = new JavaScriptSerializer().Serialize(emp); var result = client.UploadString(new Uri(baseApi + ApiControllerUrl + "/Put?Id=" + emp.Folio), "PUT" , dataString); return(Request.CreateResponse(HttpStatusCode.OK, result, Configuration.Formatters.JsonFormatter)); }
public HttpResponseMessage Put_Datos_Generales(Cantidad_fraccion_platillos varCantidad_fraccion_platillos_Datos_Generales) { var data = "-1"; try { data = Convert.ToString(this.service.Update_Datos_Generales(varCantidad_fraccion_platillos_Datos_Generales)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varCantidad_fraccion_platillos_Datos_Generales.Folio, BitacoraHelper.TypeSql.UPDATE, "sp_UpdCantidad_fraccion_platillos", new JavaScriptSerializer().Serialize(varCantidad_fraccion_platillos_Datos_Generales), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varCantidad_fraccion_platillos_Datos_Generales.Folio, BitacoraHelper.TypeSql.UPDATE, "sp_UpdCantidad_fraccion_platillos", new JavaScriptSerializer().Serialize(varCantidad_fraccion_platillos_Datos_Generales), false, ex.Message); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } return(Request.CreateResponse(HttpStatusCode.OK, data, Configuration.Formatters.JsonFormatter)); }
public HttpResponseMessage Cantidad_fraccion_platillosGenerateID() { Cantidad_fraccion_platillos varCantidad_fraccion_platillos = new Cantidad_fraccion_platillos(); var data = "-1"; try { data = Convert.ToString(this.service.Insert(varCantidad_fraccion_platillos)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_Cantidad_fraccion_platillosGenerateID", new JavaScriptSerializer().Serialize(varCantidad_fraccion_platillos), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_Cantidad_fraccion_platillosGenerateID", new JavaScriptSerializer().Serialize(varCantidad_fraccion_platillos), true); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } return(Request.CreateResponse(HttpStatusCode.OK, data, Configuration.Formatters.JsonFormatter)); }