public async Task <IActionResult> Create(CreateMembershipModel inputModel) { if (!this.ModelState.IsValid) { return(this.View(inputModel)); } var membershipServiceModel = AutoMapperConfig.MapperInstance.Map <CreateMembershipInputModel>(inputModel); await this.membershipsService.CreateAsync(membershipServiceModel); return(this.RedirectToAction("Index")); }
public IActionResult Create() { var durations = (Duration[])Enum.GetValues(typeof(Duration)); var peopleLimits = (AmountOfPeopleLimit[])Enum.GetValues(typeof(AmountOfPeopleLimit)); var visitsLimits = (VisitLimit[])Enum.GetValues(typeof(VisitLimit)); var viewModel = new CreateMembershipModel { Durations = durations, AmountOfPeopleLimits = peopleLimits, VisitsLimits = visitsLimits, }; return(this.View(viewModel)); }