public ActionResult Consultar(CiaSegModel ciaSegModel) { ciaSegModel.Nombre = (!String.IsNullOrEmpty(ciaSegModel.Nombre)) ? ciaSegModel.Nombre : String.Empty; ciaSegModel.Estado = (!String.IsNullOrEmpty(ciaSegModel.Estado)) ? ciaSegModel.Estado : String.Empty; ViewBag.ListadoCiaSeg = CiaSegNegocio.BuscarTodos().Where(item => item.Nombre.ToLower().Contains(ciaSegModel.Nombre.ToLower()) && item.Estado.ToLower().Contains(ciaSegModel.Estado.ToLower())); return View(ciaSegModel); }
public ActionResult Actualizar(int id, CiaSegModel ciaSegModel) { if (ModelState.IsValid) { try { CiaSeg CiaSeg = CiaSegNegocio.BuscarPorId(id); HttpPostedFileBase Logo = Request.Files["UrlLogo"]; if (Logo != null) { Logo.SaveAs(System.AppDomain.CurrentDomain.BaseDirectory + RutaImagen + Logo.FileName); CiaSeg.UrlLogo = RutaImagen + Logo.FileName; } CiaSeg.Nombre = ciaSegModel.Nombre; CiaSeg.Estado = ciaSegModel.Estado; ViewBag.CiaSeg = CiaSegNegocio.Actualizar(CiaSeg); } catch (Exception ex) { ViewBag.Exception = ex.Message; } } return View(); }
public ActionResult Register(CiaSegModel ciaSegModel) { if (ModelState.IsValid) { CiaSeg CiaSeg = ciaSegModel.ObtenerEntidad(); CiaSeg.UsuarioRegistra.Id = Convert.ToInt32(User.Identity.Name); CiaSegNegocio.Insertar(CiaSeg); return RedirectToRoute("Aseguradora", new { action = "Search" }); } return View(ciaSegModel); }
public ActionResult Edit(int id, CiaSegModel ciaSegModel) { if (ModelState.IsValid) { CiaSeg CiaSeg = CiaSegNegocio.BuscarPorId(id); CiaSeg.Nombre = ciaSegModel.Nombre; CiaSeg.Estado = ciaSegModel.Estado; CiaSegNegocio.Actualizar(CiaSeg); return RedirectToRoute("Aseguradora", new { action = "Search" }); } return View(ciaSegModel); }
public ActionResult New(CiaSegModel ciaSegModel) { if (ModelState.IsValid) { CiaSeg CiaSeg = ciaSegModel.ObtenerEntidad(); CiaSeg.UsuarioRegistra = new Usuario() { Id = Convert.ToInt32(User.Identity.Name) }; CiaSeg.FechaRegistro = DateTime.Now; CiaSegNegocio.Insertar(CiaSeg); return RedirectToRoute("Aseguradora", new { action = "Index" }); } return View(ciaSegModel); }
public ActionResult Index(CiaSegModel ciaSegModel) { string Estado = Sanitizer.GetSafeHtmlFragment(ciaSegModel.Estado); string Nombre = Sanitizer.GetSafeHtmlFragment(ciaSegModel.Nombre); if (!String.IsNullOrEmpty(Estado)) { ViewBag.ListadoCiaSeg = CiaSegNegocio.BuscarTodos().Where(item => item.Estado.Equals(Estado)); } else { ViewBag.ListadoCiaSeg = CiaSegNegocio.BuscarTodos().Where(item => item.Nombre.Contains(Nombre)); } return View(ciaSegModel); }
public ActionResult Registrar(CiaSegModel ciaSegModel) { if (ModelState.IsValid) { try { HttpPostedFileBase Logo = Request.Files["UrlLogo"]; if (Logo != null) { Logo.SaveAs(System.AppDomain.CurrentDomain.BaseDirectory + RutaImagen + Logo.FileName); } CiaSeg CiaSeg = new CiaSeg() { Nombre = ciaSegModel.Nombre, Estado = ciaSegModel.Estado, UrlLogo = RutaImagen + Logo.FileName, UsuarioRegistro = new Usuario() { Id = Convert.ToInt32(User.Identity.Name) }, FechaRegistro = DateTime.Now }; ViewBag.CiaSeg = CiaSegNegocio.Insertar(CiaSeg); } catch (Exception ex) { ViewBag.Exception = ex.Message; } } return View(ciaSegModel); }