Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Surname,Phone,Email,TrainerId")] Client client)
        {
            if (id != client.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(client);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClientExists(client.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TrainerId"] = new SelectList(_context.Trainers, "Id", "Name", client.TrainerId);
            return(View(client));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,Area")] Gym gym)
        {
            if (id != gym.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(gym);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GymExists(gym.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(gym));
        }
Пример #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,ClientId,PassesId,Month,IsPaymentDone,Sum,ClCardNumber,CompanyCardNumber,IsOverPay,IsDebt")] Payment payment)
        {
            if (id != payment.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(payment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PaymentExists(payment.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClientId"] = new SelectList(_context.Clients, "Id", "Id", payment.ClientId);
            ViewData["PassesId"] = new SelectList(_context.Passes, "Id", "Id", payment.PassesId);
            return(View(payment));
        }
Пример #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Description,Price,GymId")] Pass pass)
        {
            if (id != pass.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pass);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PassExists(pass.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GymId"] = new SelectList(_context.Gyms, "Id", "Id", pass.GymId);
            return(View(pass));
        }
Пример #5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Surname,Salary,Phone,Email")] Trainer trainer)
        {
            if (id != trainer.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(trainer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TrainerExists(trainer.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(trainer));
        }