public void ActivateVaucher(ActivateVaucherBindingModel bm) { var vaucher = this.db.Vauchers.Find(v => v.Id == bm.Id); vaucher.IsActive = true; this.db.SaveChanges(); }
public ActionResult ActivateVaucher(ActivateVaucherBindingModel bm) { if (!ModelState.IsValid) { this.AddNotification($"Failed to activate vaucher with id:{bm.Id}!", NotificationType.ERROR); return(this.RedirectToAction("PendingVauchers")); } this.service.ActivateVaucher(bm); this.AddNotification("Vaucher activated!", NotificationType.SUCCESS); return(this.RedirectToAction("PendingVauchers")); }