// GET: Members/Create public ActionResult Create() { var vm = new MemberCreateVm(); //vm.MemberStatusList = new SelectList(memberCardService.GetAllMemberCards(), "Id", "Member-Status"); return(View(vm)); }
public async Task <IActionResult> Create(MemberCreateVm vm) { if (ModelState.IsValid) { //Create new member var newMember = new Member(); newMember.SSN = vm.SSN; newMember.Name = vm.Name; memberService.AddMember(newMember); return(RedirectToAction(nameof(Index))); } return(RedirectToAction("Error", "Home", "")); }
public async Task <IActionResult> Create(MemberCreateVm vm) { if (ModelState.IsValid) { //Skapa ny Medlem var newMember = new Member(); newMember.Name = vm.Name; newMember.Email = vm.Email; memberservice.AddMember(newMember); return(RedirectToAction(nameof(Index))); } return(RedirectToAction("Error", "Home", "")); }
public ActionResult Create(MemberCreateVm vm) { //vm.MemberStatusList = new SelectList(memberCardService.GetAllMemberCards(), "Id", "Member-Status"); if (!ModelState.IsValid) { return(View(vm)); } { //Create new car var newMember = new MemberDetails(); newMember.FirstName = vm.FirstName; newMember.LastName = vm.LastName; newMember.Adress = vm.Adress; newMember.Age = vm.Age; newMember.DriversLicense = vm.DriversLicense; newMember.MemberCardId = vm.MemberCardId; memberService.AddMember(newMember); return(RedirectToAction(nameof(Index))); } }
//GET: Create Member public IActionResult Create() { var vm = new MemberCreateVm(); return(View(vm)); }