public ActionResult Add(AddBannedEmailViewModel addBannedEmailViewModel) { using (var unitOfWork = UnitOfWorkManager.NewUnitOfWork()) { try { if (!string.IsNullOrEmpty(addBannedEmailViewModel.Email)) { var bannedEmail = new BannedEmail { Email = addBannedEmailViewModel.Email, DateAdded = DateTime.Now }; _bannedEmailService.Add(bannedEmail); TempData[AppConstants.MessageViewBagName] = new GenericMessageViewModel { Message = "Email added", MessageType = GenericMessages.success }; unitOfWork.Commit(); } else { TempData[AppConstants.MessageViewBagName] = new GenericMessageViewModel { Message = "Please add an email address", MessageType = GenericMessages.error }; } } catch (Exception ex) { unitOfWork.Rollback(); LoggingService.Error(ex); TempData[AppConstants.MessageViewBagName] = new GenericMessageViewModel { Message = LocalizationService.GetResourceString("Errors.GenericMessage"), MessageType = GenericMessages.error }; } } return RedirectToAction("Index"); }
public void Delete(BannedEmail bannedEmail) { _bannedEmailRepository.Delete(bannedEmail); }
public BannedEmail Add(BannedEmail bannedEmail) { return _bannedEmailRepository.Add(bannedEmail); }
public void Delete(BannedEmail bannedEmail) { _context.BannedEmail.Remove(bannedEmail); }
public BannedEmail Add(BannedEmail bannedEmail) { return _context.BannedEmail.Add(bannedEmail); }