public ActionResult Create(LFGC1_MuestraProductos_Result lfgcmpr) { if (!ModelState.IsValid) { return(View()); } try { var db = new DataProductsEntities(); db.LFGC1_InsertaNuevoProducto( lfgcmpr.IdType, lfgcmpr.IdColor, lfgcmpr.IdBrand, lfgcmpr.IdProvider, lfgcmpr.IdCatalog, lfgcmpr.Title, lfgcmpr.Nombre, lfgcmpr.Description, lfgcmpr.Observations, lfgcmpr.PriceDistributor, lfgcmpr.PriceClient, lfgcmpr.PriceMember, lfgcmpr.IsEnabled, lfgcmpr.Keywords, lfgcmpr.DateUpdate = DateTime.Now ); return(RedirectToAction("Index")); } catch (Exception e) { throw e; } }
public ActionResult Delete(int id) { using (var db = new DataProductsEntities()) { LFGC1_MuestraProductos_Result Del = db.LFGC1_MuestraProductos().Where(a => a.Id == id).FirstOrDefault(); db.LFGC1_EliminaProductoPorID(id); db.SaveChanges(); return(RedirectToAction("Index")); } }
//get, solo llama a la vista public ActionResult Create() { var CollectionModel = new LFGC1_MuestraProductos_Result(); using (var db = new DataProductsEntities()) { CollectionModel.ColorsCollection = db.CatColors.ToList <CatColors>(); CollectionModel.TypeCollection = db.CatTypeProduct.ToList <CatTypeProduct>(); CollectionModel.BrandsCollection = db.CatBrands.ToList <CatBrands>(); CollectionModel.ProvidersCollection = db.CatProviders.ToList <CatProviders>(); CollectionModel.CatalogsCollection = db.CatCatalogs.ToList <CatCatalogs>(); } return(View(CollectionModel)); }