public ActionResult EditarLaboratorio(int id, int?page, string search, LaboratorioViewModels model) { try { var laboratorioConverterRequest = new LaboratorioConverterRequest { Laboratorio = model.Laboratorio, IdUsuarioLogueado = Logueado.idUsuario, LaboratorioModel = model }; var laboratorio = _laboratorioConverter.ConvertFrom(laboratorioConverterRequest); _laboratorioBl.UpdateLaboratorio(laboratorio); ViewBag.page = page; ViewBag.search = search; return(RedirectToAction("Index", new { page, search })); } catch (Exception) { return(View("Error")); } }
public ActionResult EditarLaboratorio(int id, int?page, string search, LaboratorioViewModels model, int tipo, int categoria) { try { var lab = model.Laboratorio; lab.IdCategoria = categoria; lab.tipo = tipo; lab.nombreInstitucion = Session["nombreInstitucion"].ToString(); lab.nombreDisa = Session["nombreDisa"].ToString(); lab.nombreRed = Session["nombreRed"].ToString(); lab.nombreMicroRED = Session["nombreMicroRED"].ToString(); var laboratorioConverterRequest = new LaboratorioConverterRequest { Laboratorio = lab, IdUsuarioLogueado = Logueado.idUsuario, LaboratorioModel = model }; var laboratorio = _laboratorioConverter.ConvertFrom(laboratorioConverterRequest); if (Request.Files["Logo"] != null && Request.Files["Logo"].ContentLength > 0) { laboratorio.Logo = FileHelpers.GetBytes(Request.Files["Logo"]); } if (Request.Files["LogoRegional"] != null && Request.Files["LogoRegional"].ContentLength > 0) { laboratorio.LogoRegional = FileHelpers.GetBytes(Request.Files["LogoRegional"]); } if (Request.Files["Sello"] != null && Request.Files["Sello"].ContentLength > 0) { laboratorio.Sello = FileHelpers.GetBytes(Request.Files["Sello"]); } _laboratorioBl.UpdateLaboratorio(laboratorio); ViewBag.page = page; ViewBag.search = search; ViewBag.ocultar = "si"; //model.Sello = laboratorio.Sello; //model.Logo = laboratorio.Logo; //model.LogoRegional = laboratorio.LogoRegional; //return View("_EditarLaboratorio", model); //Actualizar lista estatica de establecimientos StaticCache.RecargarLaboratorios(); return(RedirectToAction("EditarLaboratorio", new { id = id, page = page, search = search })); } catch (Exception) { return(View("Error")); } }