Ejemplo n.º 1
0
        public ActionResult Delete(int?taxPK)
        {
            ITaxesRepository taxesRepository = new TaxesRepository(db);

            if (taxPK != null)
            {
                Tax tax = taxesRepository.GetTaxByPK((int)taxPK);

                tax.Deleted = true;

                taxesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("DELETE", tax.TaxPK);
            }

            return(Redirect(Request.UrlReferrer.AbsoluteUri));
        }
Ejemplo n.º 2
0
        public ActionResult Edit(TaxView taxModel)
        {
            if (ModelState.IsValid)
            {
                ITaxesRepository taxesRepository = new TaxesRepository(db);
                Tax tax = taxesRepository.GetTaxByPK((int)taxModel.TaxPK);
                taxModel.ConvertTo(taxModel, tax);

                taxesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("UPDATE", tax.TaxPK);

                return(RedirectToAction("Index", "Tax"));
            }
            else
            {
                return(View(taxModel));
            }
        }
Ejemplo n.º 3
0
        public ActionResult Add(TaxView taxView)
        {
            if (ModelState.IsValid)
            {
                ITaxesRepository taxesRepository = new TaxesRepository(db);
                Tax tax = new Tax();

                taxView.ConvertTo(taxView, tax);

                taxesRepository.Add(tax);
                taxesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("INSERT", tax.TaxPK);

                return(RedirectToAction("Index", "Tax"));
            }
            else
            {
                return(View(taxView));
            }
        }