public ActionResult modificaPcs(int id) { //Metodo para la busqueda PcO objC = ListPcO().Where(c => c.codigo == id).FirstOrDefault(); ViewBag.categorias = new SelectList(ListCategoria(), "codigo", "nombre"); ViewBag.procesadores = new SelectList(ListProcesador(), "codigo", "nombre"); ViewBag.gpus = new SelectList(ListGpu(), "codigo", "nombre"); ViewBag.mothers = new SelectList(ListMotherboard(), "codigo", "nombre"); ViewBag.rams = new SelectList(ListRam(), "codigo", "nombre"); ViewBag.almacs = new SelectList(ListAlmacenamiento(), "codigo", "nombre"); ViewBag.fuentes = new SelectList(ListFuente(), "codigo", "nombre"); ViewBag.gabinetes = new SelectList(ListGabinete(), "codigo", "nombre"); ViewBag.monitores = new SelectList(ListMonitor(), "codigo", "nombre"); ViewBag.perifericos = new SelectList(ListPeriferico(), "codigo", "nombre"); return(View(objC)); }
public ActionResult modificaPcs(PcO objP) { List <SqlParameter> parametros = new List <SqlParameter>() { //Parametros de registro new SqlParameter() { ParameterName = "@ID_PC", SqlDbType = SqlDbType.Int, Value = objP.codigo }, new SqlParameter() { ParameterName = "@DES", SqlDbType = SqlDbType.VarChar, Value = objP.des_pc }, new SqlParameter() { ParameterName = "@CAT", SqlDbType = SqlDbType.Int, Value = objP.id_cat }, new SqlParameter() { ParameterName = "@PROC", SqlDbType = SqlDbType.Int, Value = objP.id_proc }, new SqlParameter() { ParameterName = "@GPU", SqlDbType = SqlDbType.Int, Value = objP.id_gpu }, new SqlParameter() { ParameterName = "@MB", SqlDbType = SqlDbType.Int, Value = objP.id_mb }, new SqlParameter() { ParameterName = "@RAM", SqlDbType = SqlDbType.Int, Value = objP.id_ram }, new SqlParameter() { ParameterName = "@ALM", SqlDbType = SqlDbType.Int, Value = objP.id_alm }, new SqlParameter() { ParameterName = "@PSU", SqlDbType = SqlDbType.Int, Value = objP.id_psu }, new SqlParameter() { ParameterName = "@GAB", SqlDbType = SqlDbType.Int, Value = objP.id_gab }, new SqlParameter() { ParameterName = "@MON", SqlDbType = SqlDbType.Int, Value = objP.id_mon }, new SqlParameter() { ParameterName = "@PER", SqlDbType = SqlDbType.Int, Value = objP.id_per }, new SqlParameter() { ParameterName = "@PRE", SqlDbType = SqlDbType.Money, Value = objP.precio }, new SqlParameter() { ParameterName = "@UEX", SqlDbType = SqlDbType.Int, Value = objP.uex_pro }, new SqlParameter() { ParameterName = "@UPE", SqlDbType = SqlDbType.Int, Value = objP.upe_pro }, new SqlParameter() { ParameterName = "@FOT", SqlDbType = SqlDbType.VarChar, Value = objP.foto } //(@ID_PC,@DES, @CAT , @PROC , @GPU , @MB , @RAM , @ALM , @PSU , @GAB , @MON , @PER , @PRE , @UEX , @UPE , @FOT) }; Crud("SP_ACTUALIZAPC", parametros); return(RedirectToAction("listadoPc")); }
public ActionResult nuevaPc(PcO objP, HttpPostedFileBase f) { if (f == null) { return(View(objP)); } if (Path.GetExtension(f.FileName) != ".jpg") { return(View(objP)); } List <SqlParameter> parametros = new List <SqlParameter>() { //Parametros de registro new SqlParameter() { ParameterName = "@DES", SqlDbType = SqlDbType.VarChar, Value = objP.des_pc }, new SqlParameter() { ParameterName = "@CAT", SqlDbType = SqlDbType.Int, Value = objP.id_cat }, new SqlParameter() { ParameterName = "@PROC", SqlDbType = SqlDbType.Int, Value = objP.id_proc }, new SqlParameter() { ParameterName = "@GPU", SqlDbType = SqlDbType.Int, Value = objP.id_gpu }, new SqlParameter() { ParameterName = "@MB", SqlDbType = SqlDbType.Int, Value = objP.id_mb }, new SqlParameter() { ParameterName = "@RAM", SqlDbType = SqlDbType.Int, Value = objP.id_ram }, new SqlParameter() { ParameterName = "@ALM", SqlDbType = SqlDbType.Int, Value = objP.id_alm }, new SqlParameter() { ParameterName = "@PSU", SqlDbType = SqlDbType.Int, Value = objP.id_psu }, new SqlParameter() { ParameterName = "@GAB", SqlDbType = SqlDbType.Int, Value = objP.id_gab }, new SqlParameter() { ParameterName = "@MON", SqlDbType = SqlDbType.Int, Value = objP.id_mon }, new SqlParameter() { ParameterName = "@PER", SqlDbType = SqlDbType.Int, Value = objP.id_per }, new SqlParameter() { ParameterName = "@PRE", SqlDbType = SqlDbType.Money, Value = objP.precio }, new SqlParameter() { ParameterName = "@UEX", SqlDbType = SqlDbType.Int, Value = objP.uex_pro }, new SqlParameter() { ParameterName = "@UPE", SqlDbType = SqlDbType.Int, Value = objP.upe_pro }, new SqlParameter() { ParameterName = "@FOT", SqlDbType = SqlDbType.VarChar, Value = "~/fotos_pc/" + Path.GetFileName(f.FileName) } //(@DES, @CAT , @PROC , @GPU , @MB , @RAM , @ALM , @PSU , @GAB , @MON , @PER , @PRE , @UEX , @UPE , @FOT) }; ViewBag.categorias = new SelectList(ListCategoria(), "codigo", "nombre"); ViewBag.procesadores = new SelectList(ListProcesador(), "codigo", "nombre"); ViewBag.gpus = new SelectList(ListGpu(), "codigo", "nombre"); ViewBag.mothers = new SelectList(ListMotherboard(), "codigo", "nombre"); ViewBag.rams = new SelectList(ListRam(), "codigo", "nombre"); ViewBag.almacs = new SelectList(ListAlmacenamiento(), "codigo", "nombre"); ViewBag.fuentes = new SelectList(ListFuente(), "codigo", "nombre"); ViewBag.gabinetes = new SelectList(ListGabinete(), "codigo", "nombre"); ViewBag.monitores = new SelectList(ListMonitor(), "codigo", "nombre"); ViewBag.perifericos = new SelectList(ListPeriferico(), "codigo", "nombre"); Crud("SP_NUEVAPC", parametros); f.SaveAs(Path.Combine(Server.MapPath("~/fotos_pc/"), Path.GetFileName(f.FileName))); return(RedirectToAction("listadoPc")); }