public ActionResult Delete(ProveedorViewModels proveedor) { App_Start.AutoMapperWebConfiguration.Configure(); dtoProveedor dtoProveedor = Mapper.Map <ProveedorViewModels, dtoProveedor>(proveedor); var bll = new dtoProveedor(); bll.Eliminar(dtoProveedor); return(RedirectToAction("Index")); }
public ActionResult Guardar(ProveedorViewModels proveedor) { var nuevoProveedor = new Proveedor { razon_social = proveedor.razon_social, cuit = proveedor.cuit, direccion = proveedor.direccion }; gestorProveedor.Guardar(nuevoProveedor); return(RedirectToAction("Listar")); }
public ActionResult NuevaTarifaDetalle(string Proveedor, string Tarifa, HttpPostedFileBase postedFile) { var cuenta = Session["CUENTA"] as Cuenta; var TarifDetalle = Fachada.ObtenerTarifaDetalle(Proveedor, Tarifa).FirstOrDefault(); if (TarifDetalle == null) { return(HttpNotFound("No se encontrĂ³ el detalle solicitado")); } ViewBag.Proveedor = TarifDetalle.PROVEEDOR; ViewBag.Proveedor_Nombre = TarifDetalle.PROVEEDOR_NOMBRE; ViewBag.Tarifa = TarifDetalle.TARIFA; ViewBag.Tarifa_Nombre = TarifDetalle.TARIFA_NOMBRE; List <ProveedorViewModels> usersList = new List <ProveedorViewModels>(); if (Request != null) { HttpPostedFileBase file = Request.Files["UploadedFile"]; if ((file != null) && (file.ContentLength > 0) && !string.IsNullOrEmpty(file.FileName)) { string fileName = file.FileName; string fileContentType = file.ContentType; byte[] fileBytes = new byte[file.ContentLength]; var data = file.InputStream.Read(fileBytes, 0, Convert.ToInt32(file.ContentLength)); using (var package = new ExcelPackage(file.InputStream)) { var currentSheet = package.Workbook.Worksheets; var workSheet = currentSheet.First(); var noOfCol = workSheet.Dimension.End.Column; var noOfRow = workSheet.Dimension.End.Row; for (int rowIterator = 2; rowIterator <= noOfRow; rowIterator++) { var user = new ProveedorViewModels(); user.SERVICIO = workSheet.Cells[rowIterator, 1].Value.ToString(); user.DESCRIPCION = workSheet.Cells[rowIterator, 2].Value.ToString(); user.RANGO_DEL = workSheet.Cells[rowIterator, 3].Value.ToString(); user.RANGO_AL = workSheet.Cells[rowIterator, 4].Value.ToString(); user.PRECIO = workSheet.Cells[rowIterator, 5].Value.ToString(); usersList.Add(user); } } } } return(View(usersList)); }
public ActionResult Create(ProveedorViewModels proveedor) { if (ModelState.IsValid) { var DTO = Mapper.Map <ProveedorViewModels, dtoProveedor>(proveedor); var BLL = new dtoProveedor(); BLL.Crear(DTO); return(RedirectToAction("Index")); } else { return(View(proveedor)); } }
public ActionResult Edit(ProveedorViewModels proveedor) { if (ModelState.IsValid) { App_Start.AutoMapperWebConfiguration.Configure(); dtoProveedor DTO = Mapper.Map <ProveedorViewModels, dtoProveedor>(proveedor); var bll = new dtoProveedor(); bll.Actualizar(DTO); return(RedirectToAction("Index")); } else { return(View(proveedor)); } }
public ActionResult NuevaTarifa(string Proveedor) { var cuenta = Session["CUENTA"] as Cuenta; var proveedor = Fachada.ObtenerProveedor(Proveedor).FirstOrDefault(); if (proveedor == null) { return(HttpNotFound("No se encontrĂ³ el proveedor solicitado")); } var modelo = new ProveedorViewModels() { PROVEEDOR = proveedor.PROVEEDOR, NOMBRE = proveedor.NOMBRE }; return(View(modelo)); }