// GET: Order/Edit/5 public ActionResult Edit(int id) { //TODO: la plantilla de editar y crear son iguales podria refactorizarse... using (var service = new ServiceModeloNegocio.ServiceClient()) { ViewBag.ProductosDisponibles = service.GetAllProductsDisponibles(); ViewBag.CustomersList = service.GetListCustomersByEstado(Estado.ACTIVO); /* * Creo un ListItem solo con numeros para mostrar en un elemento ListBox en la plantilla de crear orden */ var cantidad = new List <ListItem>(); const int cantidad_maxima_productos = 5; // Es la cantidad maxima de productos que puede seleccionar un usuario for (int count = 0; count <= cantidad_maxima_productos; count++) { cantidad.Add(new ListItem { Text = count.ToString(), Value = count.ToString() }); } ViewBag.CantidadProductos = cantidad; var order = service.GetOrderById(id); ViewBag.OrdenAeditar = order; return(View()); } }
public Order Get(int id) { using (var service = new ServiceModeloNegocio.ServiceClient()) { var order = service.GetOrderById(id); return(order); } }
// GET: Order/Details/5 public ActionResult Details(int id) { using (var service = new ServiceModeloNegocio.ServiceClient()) { var order = service.GetOrderById(id); return(View(order)); } }
public HttpResponseMessage Delete(int id) { using (var service = new ServiceModeloNegocio.ServiceClient()) { var order = service.GetOrderById(id); service.DeleteOrder(order); return(Request.CreateResponse <Order>(HttpStatusCode.Gone, order)); } }
public ActionResult Delete(int id, FormCollection collection) { try { using (var service = new ServiceModeloNegocio.ServiceClient()) { var order = service.GetOrderById(id); service.DeleteOrder(order); } return(RedirectToAction("Index")); } catch { return(View("Index")); } }