public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Specialist_IN,Contact")] Specialist specialist)
        {
            if (id != specialist.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(specialist);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SpecialistExists(specialist.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(specialist));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Staff_Name,Department,Staff_Contact")] Staff staff)
        {
            if (id != staff.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(staff);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StaffExists(staff.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(staff));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name_of_clinic,Address,Contact")] Location location)
        {
            if (id != location.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(location);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LocationExists(location.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(location));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Patient_Name,Address,Patient_Age,Joining_Date")] Patient patient)
        {
            if (id != patient.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(patient);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PatientExists(patient.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(patient));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,PatientId,StaffId,LocationId,SpecialistId")] Appointment appointment)
        {
            if (id != appointment.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(appointment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AppointmentExists(appointment.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LocationId"]   = new SelectList(_context.Location, "Id", "Id", appointment.LocationId);
            ViewData["PatientId"]    = new SelectList(_context.Patient, "Id", "Id", appointment.PatientId);
            ViewData["SpecialistId"] = new SelectList(_context.Specialist, "Id", "Id", appointment.SpecialistId);
            ViewData["StaffId"]      = new SelectList(_context.Staff, "Id", "Id", appointment.StaffId);
            return(View(appointment));
        }