public ActionResult Settings(PartnerSettingsViewModel partnerSettingsViewModel) { if (!this.ValidateAndAppendMessages(partnerSettingsViewModel)) { this.AddCountryDataToViewBag(); return(this.View(partnerSettingsViewModel)); } using (var unitOfWork = this.UnitOfWorkFactory.NewUnitOfWork()) { try { var partner = this.GetPartnerIfAuthorized(partnerSettingsViewModel.PartnerId); if (partner == null) { return(this.Issue404()); } Mapper.Map(partnerSettingsViewModel, partner); partner.DateModified = DateTime.Now; unitOfWork.Commit(); this.ForwardMessage(new SuccessMessage { Text = GenericMessages.SuccessMessage }); return(RedirectToAction("Settings", new { partnerSettingsViewModel.PartnerId })); } catch (Exception ex) { this.LogHandledException(ex); this.AddCountryDataToViewBag(); return(this.View(partnerSettingsViewModel)); } } }
public ActionResult Settings(PartnerSettingsViewModel partnerSettingsViewModel) { if(!this.ValidateAndAppendMessages(partnerSettingsViewModel)) { this.AddCountryDataToViewBag(); return this.View(partnerSettingsViewModel); } using(var unitOfWork = this.UnitOfWorkFactory.NewUnitOfWork()) { try { var partner = this.GetPartnerIfAuthorized(partnerSettingsViewModel.PartnerId); if (partner == null) { return this.Issue404(); } Mapper.Map(partnerSettingsViewModel, partner); partner.DateModified = DateTime.Now; unitOfWork.Commit(); this.ForwardMessage(new SuccessMessage { Text = GenericMessages.SuccessMessage }); return RedirectToAction("Settings", new { partnerSettingsViewModel.PartnerId }); } catch(Exception ex) { this.LogHandledException(ex); this.AddCountryDataToViewBag(); return this.View(partnerSettingsViewModel); } } }