public ActionResult Servicio(int? id = null) { if (!this.currentUser()) { return RedirectToAction("Ingresar"); } if (!this.isAdministrator()) { return RedirectToAction("Index"); } ViewBag.Title = "Servicio"; MenuNavBarSelected(11); UsuarioDTO user = getCurrentUser(); ServicioBL objBL = new ServicioBL(); MonedaBL monedaBL = new MonedaBL(); ViewBag.lstMonedas = monedaBL.getListaMonedas(); var objSent = TempData["Servicio"]; if (objSent != null) { TempData["Servicio"] = null; return View(objSent); } ServicioDTO obj; if (id != null && id != 0) { obj = objBL.getServicioEnEmpresa((int)user.IdEmpresa, (int)id); if (obj == null) return RedirectToAction("Servicios"); if (obj.IdEmpresa != user.IdEmpresa) return RedirectToAction("Servicios"); return View(obj); } obj = new ServicioDTO(); obj.IdEmpresa = user.IdEmpresa; return View(obj); }
public ActionResult Item(int? id = null) { if (!this.currentUser()) { return RedirectToAction("Ingresar"); } if (!this.isAdministrator()) { return RedirectToAction("Index"); } ViewBag.Title = "Item"; MenuNavBarSelected(10, 0); UsuarioDTO user = getCurrentUser(); ItemBL objBL = new ItemBL(); ViewBag.lstCategoriaItm = objBL.getCategoriasEnEmpresa(user.IdEmpresa); MonedaBL monedaBL = new MonedaBL(); ViewBag.lstMonedas = monedaBL.getListaMonedas(); var objSent = TempData["Item"]; if (objSent != null) { TempData["Item"] = null; return View(objSent); } ItemDTO obj; if (id != null && id != 0) { obj = objBL.getItemEnEmpresa((int)user.IdEmpresa, (int)id); if (obj == null) return RedirectToAction("Items"); if (obj.IdEmpresa != user.IdEmpresa) return RedirectToAction("Items"); return View(obj); } obj = new ItemDTO(); obj.IdEmpresa = user.IdEmpresa; return View(obj); }