// GET: /DSR/DsrCreate public ActionResult DsrCreate() { DSR dsr = new DSR(); #region populaobjetos var lojas = _lojaAppService.Find(t => t.CodigoLojaAlternate.Trim() != "-2" && t.CodigoLojaAlternate.Trim() != "-1"); ; IEnumerable<SelectListItem> lojaSelectListItem = new SelectList(lojas, "CodigoLojaAlternate", "NomeLoja"); ViewBag.CODIGOLOJAALTERNATE = new SelectList(lojas, "CodigoLojaAlternate", "NomeLoja"); #endregion populaobjetos DSRViewModel dsrVM = new DSRViewModel(dsr, lojaSelectListItem); return View(dsrVM); }
// GET: /DSR/DsrEdit/5 public ActionResult DsrEdit(int? id) { if (id == null) { //return new HttpStatusCodeResult(HttpStatusCode.BadRequest); throw new Exception(); } var dsr = _dsrAppService.Get(id ?? default(int)); if (dsr == null) { //return HttpNotFound(); throw new Exception(); } #region populaobjetos var lojas = _lojaAppService.Find(t => t.CodigoLojaAlternate.Trim() != "-2" && t.CodigoLojaAlternate.Trim() != "-1"); IEnumerable<SelectListItem> lojaSelectListItem = new SelectList(lojas, "CodigoLojaAlternate", "NomeLoja"); ViewBag.CODIGOLOJAALTERNATE = new SelectList(lojas, "CodigoLojaAlternate", "NomeLoja", dsr.CODIGOLOJAALTERNATE); #endregion populaobjetos DSRViewModel dsrVM = new DSRViewModel(dsr, lojaSelectListItem); return View(dsrVM); }
// // GET: /DSR/DsrDelete/5 public ActionResult DsrDelete(int? id, bool? saveChangesError = false) { if (id == null) { //return new HttpStatusCodeResult(HttpStatusCode.BadRequest); //throw new InvalidOperationException("Something very bad happened while doing important stuff"); throw new Exception(); } if (saveChangesError.GetValueOrDefault()) { ViewBag.ErrorMessage = "Erro na exclusão. Tente novamente ou, se o problema persistir, entre em contato com o suporte."; } var dsr = _dsrAppService.Get(id ?? default(int)); if (dsr == null) { //return HttpNotFound(); throw new Exception(); } //return View(categoriapercentual); Loja loja = _lojaAppService.Find(t => t.CodigoLojaAlternate == dsr.CODIGOLOJAALTERNATE).FirstOrDefault(); DSRViewModel dsrVM = new DSRViewModel(dsr, loja); return View(dsrVM); }