public ActionResult Platillovotacion() { PlatilloModel objModel = new PlatilloModel(); DataTable dt = objModel.VotoPlatillo(int.Parse(Session["Usuario"].ToString())).Tables[0]; if (dt.Rows.Count > 0) { try { ViewBag.platilo1 = dt.Rows[0]["ID_TEM"].ToString(); ViewBag.platilo2 = dt.Rows[1]["ID_TEM"].ToString(); ViewBag.platilo3 = dt.Rows[2]["ID_TEM"].ToString(); } catch (Exception) { } return(View(objModel.PlatilloVotacion().Tables[0])); } else { return(View(objModel.PlatilloVotacion().Tables[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 EditarPlatillo(PlatilloModel model) { _token = Session["Token"].ToString(); var plat = new Platillo() { Token = _token, id = model.Id, nombre = model.Nombre, tiempo = model.Tiempo, }; plat.ActualizarPlatillo(plat); return(RedirectToAction("VerPlatillos")); }
public ActionResult EditarPlatillo(int id) { if (string.IsNullOrEmpty(_token)) { RedirectToAction("Index", "Home"); } _token = Session["Token"].ToString(); var plat = new Platillo() { Token = _token }; plat = plat.ObtenerPlatillo(id); PlatilloModel model = new PlatilloModel { Id = plat.id, Nombre = plat.nombre, Tiempo = plat.tiempo, }; return(View(model)); }
public ActionResult MenuUsu() { PlatilloModel objModel = new PlatilloModel(); return(View(objModel.PlatilloPortada().Tables[0])); }