public ActionResult nuevoMonitor(MonitorO objM, HttpPostedFileBase f) { if (f == null) { return(View(objM)); } if (Path.GetExtension(f.FileName) != ".jpg") { return(View(objM));; } List <SqlParameter> parametros = new List <SqlParameter>() { //Parametros de registro new SqlParameter() { ParameterName = "@PROV", SqlDbType = SqlDbType.Int, Value = objM.id_prov }, new SqlParameter() { ParameterName = "@DES", SqlDbType = SqlDbType.VarChar, Value = objM.nombre }, new SqlParameter() { ParameterName = "@MARC", SqlDbType = SqlDbType.Int, Value = objM.id_marca }, new SqlParameter() { ParameterName = "@CAT", SqlDbType = SqlDbType.Int, Value = objM.id_categ }, new SqlParameter() { ParameterName = "@FREC", SqlDbType = SqlDbType.Int, Value = objM.mon_frec }, new SqlParameter() { ParameterName = "@PRE", SqlDbType = SqlDbType.Money, Value = objM.precio }, new SqlParameter() { ParameterName = "@UEX", SqlDbType = SqlDbType.Int, Value = objM.uex }, new SqlParameter() { ParameterName = "@UPE", SqlDbType = SqlDbType.Int, Value = objM.upe }, new SqlParameter() { ParameterName = "@FOT", SqlDbType = SqlDbType.VarChar, Value = "../fotos_monitor/" + Path.GetFileName(f.FileName) } //@PROV,@DES,@MARC,@CAT,@FREC,@PRE,@UEX,@UPE,@FOT }; ViewBag.proveedores = new SelectList(ListProveedor(), "codigo", "nombre"); ViewBag.marcas = new SelectList(ListMarca(), "codigo", "nombre"); ViewBag.categorias = new SelectList(ListCategoria(), "codigo", "nombre"); Crud("SP_NUEVOMONITOR", parametros); f.SaveAs(Path.Combine(Server.MapPath("~/fotos_monitor/"), Path.GetFileName(f.FileName))); return(RedirectToAction("listadoMonitor")); }
public ActionResult modificaMonitor(int id) { //Metodo para la busqueda MonitorO objM = ListMonitorO().Where(m => m.codigo == id).FirstOrDefault(); ViewBag.proveedores = new SelectList(ListProveedor(), "codigo", "nombre", objM.id_prov); ViewBag.marcas = new SelectList(ListMarca(), "codigo", "nombre", objM.id_marca); ViewBag.categorias = new SelectList(ListCategoria(), "codigo", "nombre", objM.id_categ); return(View(objM)); }
public ActionResult modificaMonitor(MonitorO objM) { List <SqlParameter> parametros = new List <SqlParameter>() { //Parametros de registro new SqlParameter() { ParameterName = "@ID_MON", SqlDbType = SqlDbType.Int, Value = objM.codigo }, new SqlParameter() { ParameterName = "@PROV", SqlDbType = SqlDbType.Int, Value = objM.id_prov }, new SqlParameter() { ParameterName = "@DES", SqlDbType = SqlDbType.VarChar, Value = objM.nombre }, new SqlParameter() { ParameterName = "@MARC", SqlDbType = SqlDbType.Int, Value = objM.id_marca }, new SqlParameter() { ParameterName = "@CAT", SqlDbType = SqlDbType.Int, Value = objM.id_categ }, new SqlParameter() { ParameterName = "@FREC", SqlDbType = SqlDbType.Int, Value = objM.mon_frec }, new SqlParameter() { ParameterName = "@PRE", SqlDbType = SqlDbType.Money, Value = objM.precio }, new SqlParameter() { ParameterName = "@UEX", SqlDbType = SqlDbType.Int, Value = objM.uex }, new SqlParameter() { ParameterName = "@UPE", SqlDbType = SqlDbType.Int, Value = objM.upe }, new SqlParameter() { ParameterName = "@FOT", SqlDbType = SqlDbType.VarChar, Value = objM.foto } //@PROV,@DES,@MARC,@CAT,@FREC,@PRE,@UEX,@UPE,@FOT }; Crud("SP_ACTUALIZAMONITOR", parametros); return(RedirectToAction("listadoMonitor")); }