Beispiel #1
0
        public HttpResponseMessage GetMenu(string usuario)
        {
            PlatilloModel objModel = new PlatilloModel();

            var Tabla = objModel.PlatilloPortada().Tables[0];

            if (Tabla.Rows.Count > 0)
            {
                List <Menu> menu = new List <Menu>();

                foreach (DataRow dr in Tabla.Rows)
                {
                    Menu item = new Menu()
                    {
                        Nombre = dr["NOMBRE"].ToString(),
                        Precio = dr["PRECIO"].ToString(),
                        Imagen = ""
                    };

                    menu.Add(item);
                }

                var response = this.Request.CreateResponse(HttpStatusCode.OK);
                response.Content = new StringContent(JsonConvert.SerializeObject(menu), Encoding.UTF8, "application/json");

                return(response);
            }

            var responsee = this.Request.CreateResponse(HttpStatusCode.InternalServerError);

            responsee.Content = new StringContent(JsonConvert.SerializeObject("NO ITEMS"), Encoding.UTF8, "application/json");

            return(responsee);
        }
 public ActionResult Menu()
 {
     return(View(objModel.PlatilloPortada().Tables[0]));
 }
        public ActionResult MenuUsu()
        {
            PlatilloModel objModel = new PlatilloModel();

            return(View(objModel.PlatilloPortada().Tables[0]));
        }