Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("IdGym,Name,City,Address,WorkingHours,Contact")] Gym gym)
        {
            if (ModelState.IsValid)
            {
                _context.Add(gym);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(gym));
        }
        public async Task <IActionResult> Create([Bind("IdMembershipPlan,Name,Description")] MembershipPlan membershipPlan)
        {
            if (ModelState.IsValid)
            {
                _context.Add(membershipPlan);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(membershipPlan));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("IdTrainer,FirstName,LastName,DateOfBirth,Qualifications,Achievements,IdGym")] Trainer trainer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(trainer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdGym"] = new SelectList(_context.Gyms, "IdGym", "Address", trainer.IdGym);
            return(View(trainer));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("IdCustomer,FirstName,LastName,DateOfBirth,IdMembershipPlan,IdGym")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdGym"]            = new SelectList(_context.Gyms, "IdGym", "Address", customer.IdGym);
            ViewData["IdMembershipPlan"] = new SelectList(_context.MembershipPlans, "IdMembershipPlan", "Description", customer.IdMembershipPlan);
            return(View(customer));
        }