Esempio n. 1
0
        public ActionResult Edit(ArticuloAlmacen articuloEdit)
        {
            ArticuloAlmacenesServices articuloAlmacenServices = new ArticuloAlmacenesServices();
            bool articuloActualizado = false;

            try
            {
                if (ModelState.IsValid)
                {
                    articuloActualizado = articuloAlmacenServices.Update(articuloEdit);

                    if (articuloActualizado)
                    {
                        return(RedirectToAction("index"));
                    }
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message.ToString());
            }

            ViewBag.Almacen_ID  = new SelectList(articuloAlmacenServices.ObtenerAlmacenes(), "ID", "Almacen", articuloEdit.Almacen_ID);
            ViewBag.Articulo_ID = new SelectList(articuloAlmacenServices.ObtenerArticulos(), "ID", "Articulo", articuloEdit.Articulo_ID);

            return(View());
        }
Esempio n. 2
0
        public ActionResult Create(ArticuloAlmacen articuloAlmacenCreate)
        {
            ArticuloAlmacenesServices articuloAlmacenServices = new ArticuloAlmacenesServices();
            bool articuloAlmacenGuardado = false;


            try
            {
                if (ModelState.IsValid)
                {
                    articuloAlmacenCreate.Fecha = DateTime.Now;
                    articuloAlmacenGuardado     = articuloAlmacenServices.Save(articuloAlmacenCreate);

                    if (articuloAlmacenGuardado)
                    {
                        return(RedirectToAction("index"));
                    }
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message.ToString());
            }

            ViewBag.Almacen_ID  = new SelectList(articuloAlmacenServices.ObtenerAlmacenes(), "ID", "Almacen", articuloAlmacenCreate.Almacen_ID);
            ViewBag.Articulo_ID = new SelectList(articuloAlmacenServices.ObtenerArticulos(), "ID", "Articulo", articuloAlmacenCreate.Articulo_ID);

            return(View());
        }
Esempio n. 3
0
        public ActionResult Create()
        {
            ViewBag.Fecha = DateTime.Now.ToString();
            ArticuloAlmacenesServices articuloAlmacenServices = new ArticuloAlmacenesServices();

            ViewBag.Almacen_ID  = new SelectList(articuloAlmacenServices.ObtenerAlmacenes(), "ID", "Almacen");
            ViewBag.Articulo_ID = new SelectList(articuloAlmacenServices.ObtenerArticulos(), "ID", "Articulo");

            return(View());
        }
Esempio n. 4
0
        // GET: ArticuloAlmacen
        public ActionResult Index()
        {
            ArticuloAlmacenesServices articuloAlmacenServices = new ArticuloAlmacenesServices();
            List <vwArticuloAlmaces>  listadoArticuloAlmacen  = new List <vwArticuloAlmaces>();

            listadoArticuloAlmacen = articuloAlmacenServices.ObtenerArticulosAlmacen();


            return(View(listadoArticuloAlmacen));
        }
Esempio n. 5
0
        public ActionResult Edit(int?id)
        {
            ArticuloAlmacenesServices articuloAlmacenServices = new ArticuloAlmacenesServices();
            ArticuloAlmacen           articuloAlmacen         = new ArticuloAlmacen();

            try
            {
                if (id != null)
                {
                    articuloAlmacen = articuloAlmacenServices.ObtenerArticuloAlmacenPorId(id);

                    ViewBag.Almacen_ID  = new SelectList(articuloAlmacenServices.ObtenerAlmacenes(), "ID", "Almacen", articuloAlmacen.Almacen_ID);
                    ViewBag.Articulo_ID = new SelectList(articuloAlmacenServices.ObtenerArticulos(), "ID", "Articulo", articuloAlmacen.Articulo_ID);

                    return(View(articuloAlmacen));
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message.ToString());
            }

            return(View());
        }