public ActionResult DeleteConfirmed(long id) { CustomerTaxCategory customerTaxCategory = db.CustomerTaxCategories.Find(id); customerTaxCategory.IsDeleted = true; // db.CustomerTaxCategories.Remove(customerTaxCategory); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,CustCatName,CustCatDescription,IsActive")] CustomerTaxCategory customerTaxCategory) { if (ModelState.IsValid) { db.Entry(customerTaxCategory).State = EntityState.Modified; db.SaveChanges(); Session["success"] = "Category details updated"; return(RedirectToAction("Index")); } return(View(customerTaxCategory)); }
// GET: CustomerTaxCategories/Delete/5 public ActionResult Delete(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CustomerTaxCategory customerTaxCategory = db.CustomerTaxCategories.Find(id); if (customerTaxCategory == null) { return(HttpNotFound()); } return(View(customerTaxCategory)); }
public ActionResult Create([Bind(Include = "Id,CustCatName,CustCatDescription")] CustomerTaxCategory customerTaxCategory) { if (ModelState.IsValid) { customerTaxCategory.ModifiedBy = User.Identity.GetUserId <int>(); customerTaxCategory.DateCreated = DateTime.Now; customerTaxCategory.IsDeleted = false; customerTaxCategory.IsActive = true; db.CustomerTaxCategories.Add(customerTaxCategory); db.SaveChanges(); Session["success"] = "Customer Tax Category created"; return(RedirectToAction("Index")); } return(View(customerTaxCategory)); }