示例#1
0
        public ActionResult EdittItemInfo(InvInventario i)
        {
            int newID = 0;

            i.Activo       = true;
            i.CreadoPor    = int.Parse(Session["IdUser"].ToString());
            i.FAlta        = DateTime.Now;
            i.EnExistencia = i.Dispobibles;

            if (i.InvMin < 0)
            {
                i.InvMin = 0;
            }

            if (i.IdInventario > 0)
            {
                i.Imagen = stock.GetRawItem(i.IdInventario).Imagen;
            }

            if (i.IdTipo == -1 || i.IdSubTipo == -1 || i.IdUnidadMedida == -1)
            {
                if (i.IdInventario > 0)
                {
                    return(Redirect(Url.Action("ItemDetail", "Stock", new { id = i.IdInventario, error = 3 })));
                }
                else
                {
                    return(Redirect(Url.Action("ItemDetail", "Stock", new { error = 3 })));
                }
            }

            stock.InsertItem(i, out newID);

            return(Redirect(Url.Action("ItemDetail", "Stock", new { id = newID })));
        }