public ActionResult SubscriptionUpdate(NewsLetterSubscriptionModel model, GridCommand command) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageNewsletterSubscribers)) return AccessDeniedView(); if (!ModelState.IsValid) { //display the first model error var modelStateErrors = this.ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage); return Content(modelStateErrors.FirstOrDefault()); } var subscription = _newsLetterSubscriptionService.GetNewsLetterSubscriptionById(model.Id); subscription.Email = model.Email; subscription.Active = model.Active; _newsLetterSubscriptionService.UpdateNewsLetterSubscription(subscription); return SubscriptionList(command, new NewsLetterSubscriptionListModel()); }
public ActionResult SubscriptionUpdate(NewsLetterSubscriptionModel model, GridCommand command) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageNewsletterSubscribers)) return AccessDeniedView(); var subscription = _newsLetterSubscriptionService.GetNewsLetterSubscriptionById(model.Id); subscription.Email = model.Email; subscription.Active = model.Active; _newsLetterSubscriptionService.UpdateNewsLetterSubscription(subscription); return SubscriptionList(command, new NewsLetterSubscriptionListModel()); }