public void RemoveVaucher(RemoveVaucherBindingModel bm) { var voucher = this.db.Vauchers.Find(v => v.Id == bm.Id); voucher.IsActive = false; this.db.SaveChanges(); }
public ActionResult RemoveVaucher(RemoveVaucherBindingModel bm) { if (!ModelState.IsValid || bm.Id <= 0) { this.AddNotification("Failed to remove vaucher!", NotificationType.ERROR); return(this.RedirectToAction("MyActiveVauchers")); } this.service.RemoveVaucher(bm); this.AddNotification("Vaucher removed!", NotificationType.SUCCESS); return(this.RedirectToAction("MyActiveVauchers")); }