public ActionResult Present(int?id)
        {
            var appointment = _context.Appointments.SingleOrDefault(a => a.Id == id);

            if (appointment != null)
            {
                appointment.IsPresent = 1;
                _context.Update(appointment);
                _context.SaveChanges();
            }

            return(Redirect("/Appointments"));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,ClinicId,AddedBy,GenericName,BrandName,ExpiryDate,StorageTemperature,Manufacturer,Strength,Quantity,UnitPrice,BatchNo,ReorderLevel,ManufacturedDate,Notes")] Inventories inventories)
        {
            if (id != inventories.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(inventories);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InventoriesExists(inventories.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AddedBy"]  = new SelectList(_context.Users, "Id", "Email", inventories.AddedBy);
            ViewData["ClinicId"] = new SelectList(_context.Clinics, "Id", "Address", inventories.ClinicId);
            return(View(inventories));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,RegNo,Address,Phone,Email,SubscribedAt,BillingCycle,IsActive")] Clinics clinics)
        {
            if (id != clinics.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(clinics);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClinicsExists(clinics.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(clinics));
        }
Beispiel #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,UserId,Nic,Address,Dob,BloodGroup,EmergencyContactName,EmergencyContactPhone,EmergencyContactAddress,Notes")] Patients patients)
        {
            if (id != patients.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(patients);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PatientsExists(patients.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "Id", "Email", patients.UserId);
            return(View(patients));
        }
Beispiel #5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,UserId,RoleGroupId")] UserRoleGroups userRoleGroups)
        {
            if (id != userRoleGroups.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(userRoleGroups);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserRoleGroupsExists(userRoleGroups.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RoleGroupId"] = new SelectList(_context.RoleGroups, "Id", "Name", userRoleGroups.RoleGroupId);
            ViewData["UserId"]      = new SelectList(_context.Users, "Id", "Name", userRoleGroups.UserId);
            return(View(userRoleGroups));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] RoleGroups roleGroups)
        {
            if (id != roleGroups.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(roleGroups);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RoleGroupsExists(roleGroups.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(roleGroups));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,ClinicId,DoctorId,Start,Stop,HasConducted,Fee")] Sessions sessions)
        {
            if (id != sessions.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sessions);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SessionsExists(sessions.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClinicId"] = new SelectList(_context.Clinics, "Id", "Address", sessions.ClinicId);
            ViewData["DoctorId"] = new SelectList(_context.Doctors, "Id", "Phone", sessions.DoctorId);
            return(View(sessions));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,UserId,Specialization,RegistrationNumber,Hospital,Phone,Notes")] Doctors doctors)
        {
            if (id != doctors.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(doctors);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DoctorsExists(doctors.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "Id", "Email", doctors.UserId);
            return(View(doctors));
        }
Beispiel #9
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,AppointmentId,InventoryId,Quantity,Dosage,Notes,IssuedAt,IsPublic")] Prescriptions prescriptions)
        {
            if (id != prescriptions.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(prescriptions);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PrescriptionsExists(prescriptions.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AppointmentId"] = new SelectList(_context.Appointments, "Id", "Id", prescriptions.AppointmentId);
            ViewData["InventoryId"]   = new SelectList(_context.Inventories, "Id", "BrandName", prescriptions.InventoryId);
            return(View(prescriptions));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,ClinicId,PatientId,DoctorId,SessionId,AppointedAt,IsPresent,CreatedBy,Diagnosis")] Appointments appointments)
        {
            if (id != appointments.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(appointments);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AppointmentsExists(appointments.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClinicId"]  = new SelectList(_context.Clinics, "Id", "Address", appointments.ClinicId);
            ViewData["CreatedBy"] = new SelectList(_context.Users, "Id", "Email", appointments.CreatedBy);
            ViewData["DoctorId"]  = new SelectList(_context.Doctors, "Id", "Phone", appointments.DoctorId);
            ViewData["PatientId"] = new SelectList(_context.Patients, "Id", "Address", appointments.PatientId);
            ViewData["SessionId"] = new SelectList(_context.Sessions, "Id", "Id", appointments.SessionId);
            return(View(appointments));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Email,Password,ClinicId")] Users users)
        {
            if (id != users.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    users.Password = Hashing.CalculateMD5Hash(users.Password);
                    _context.Update(users);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UsersExists(users.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClinicId"] = new SelectList(_context.Clinics, "Id", "Address", users.ClinicId);
            return(View(users));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,AppointmentId,Description,Amount,PaidAt,IsReceived,Method")] Payments payments)
        {
            if (id != payments.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(payments);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PaymentsExists(payments.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AppointmentId"] = new SelectList(_context.Appointments, "Id", "Id", payments.AppointmentId);
            return(View(payments));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,ClinicId,Amount,IssuedAt,PaidAt")] SubscriptionInvoices subscriptionInvoices)
        {
            if (id != subscriptionInvoices.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(subscriptionInvoices);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SubscriptionInvoicesExists(subscriptionInvoices.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClinicId"] = new SelectList(_context.Clinics, "Id", "Name", subscriptionInvoices.ClinicId);
            return(View(subscriptionInvoices));
        }