public ActionResult Create(CreateNewspaperViewModel vm) { var entity = SessionHelper.CurrentEntity; var can = newspaperService.CanCreateNewspaper(entity); if (can.IsError) { return(RedirectBackWithError(can)); } var country = entity.GetCurrentCountry(); var result = newspaperService.CanCreateNewspaper(entity, vm.Name, SessionHelper.LoggedCitizen); if (result.IsError) { return(RedirectBackWithError(result)); } if (ModelState.IsValid) { var newspaper = newspaperService.CreateNewspaper(entity, vm.Name, country.ID, SessionHelper.LoggedCitizen); AddSuccess("Newspaper {0} was sucessfuly created!", vm.Name); return(RedirectToAction("View", new { newspaperID = newspaper.ID })); } var configuration = ConfigurationHelper.Configuration; vm = new CreateNewspaperViewModel(country, configuration, vm.Name); return(View(vm)); }
public ActionResult Create() { var entity = SessionHelper.CurrentEntity; var can = newspaperService.CanCreateNewspaper(entity); if (can.IsError) { return(RedirectBackWithError(can)); } var country = entity.GetCurrentCountry(); var configuration = ConfigurationHelper.Configuration; var vm = new CreateNewspaperViewModel(country, configuration); return(View(vm)); }