Example #1
0
 public ActionResult UnBanCustomer(BanUnBanCustomerBindingModel bm)
 {
     if (!ModelState.IsValid || !this.service.UnBanCustomer(bm))
     {
         this.AddNotification("Failed unban customer!", NotificationType.ERROR);
         return(this.RedirectToAction("BannedCustomers"));
     }
     this.AddNotification("Customer unbanned!", NotificationType.SUCCESS);
     return(this.RedirectToAction("BannedCustomers"));
 }
        public bool UnBanCustomer(BanUnBanCustomerBindingModel bm)
        {
            var customer = this.db.Customers.Find(c => c.AppUser.UserName == bm.Username);

            if (customer == null)
            {
                return(false);
            }

            customer.IsBanned = false;
            this.db.SaveChanges();
            return(true);
        }