Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,ClientId,ConsultantId")] ConsultationBooking consultationBooking)
        {
            if (id != consultationBooking.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(consultationBooking);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ConsultationBookingExists(consultationBooking.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClientId"]     = new SelectList(_context.Client, "Id", "Id", consultationBooking.ClientId);
            ViewData["ConsultantId"] = new SelectList(_context.Consultant, "Id", "Id", consultationBooking.ConsultantId);
            return(View(consultationBooking));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,WebSite")] Agency agency)
        {
            if (id != agency.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(agency);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AgencyExists(agency.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(agency));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Email,AgencyId")] Consultant consultant)
        {
            if (id != consultant.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(consultant);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ConsultantExists(consultant.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AgencyId"] = new SelectList(_context.Agency, "Id", "Id", consultant.AgencyId);
            return(View(consultant));
        }
Пример #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Email")] 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)));
            }
            return(View(client));
        }