示例#1
0
        // GET: Members/Create
        public ActionResult Create()
        {
            var vm = new MemberCreateVm();

            //vm.MemberStatusList = new SelectList(memberCardService.GetAllMemberCards(), "Id", "Member-Status");
            return(View(vm));
        }
示例#2
0
        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", ""));
        }
示例#3
0
        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", ""));
        }
示例#4
0
        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)));
            }
        }
示例#5
0
        //GET: Create Member
        public IActionResult Create()
        {
            var vm = new MemberCreateVm();

            return(View(vm));
        }