public ActionResult EditPsychologists(int id, DoctorCollection model)
        {
            var psychologist = db.Psychologists.Single(c => c.Id == id);

            psychologist.FirstName      = model.Psychologist.FirstName;
            psychologist.LastName       = model.Psychologist.LastName;
            psychologist.FullName       = "Dr. " + model.Psychologist.FirstName + " " + model.Psychologist.LastName;
            psychologist.ContactNo      = model.Psychologist.ContactNo;
            psychologist.PhoneNo        = model.Psychologist.PhoneNo;
            psychologist.Education      = model.Psychologist.Education;
            psychologist.DepartmentId   = model.Psychologist.DepartmentId;
            psychologist.Specialization = model.Psychologist.Specialization;
            psychologist.Gender         = model.Psychologist.Gender;

            psychologist.DateOfBirth = model.Psychologist.DateOfBirth;
            psychologist.Address     = model.Psychologist.Address;
            psychologist.Status      = model.Psychologist.Status;
            db.SaveChanges();

            string audiuserName = User.Identity.GetUserName();

            AuditExtension.AddAudit(audiuserName, "Updated Psychologist Details", "psychologists");

            return(RedirectToAction("ListOfPsychologists"));
        }
Exemplo n.º 2
0
        public ActionResult EditDoctors(int id)
        {
            var collection = new DoctorCollection
            {
                Departments = db.Department.ToList(),
                Doctor      = db.Doctors.Single(c => c.Id == id)
            };

            return(View(collection));
        }
        public ActionResult EditPsychologists(int id)
        {
            var collection = new DoctorCollection
            {
                Centres      = db.Centre.ToList(),
                Psychologist = db.Psychologists.Single(c => c.Id == id)
            };

            return(View(collection));
        }
Exemplo n.º 4
0
        public ActionResult AddDoctor()
        {
            var collection = new DoctorCollection
            {
                ApplicationUser = new RegisterViewModel(),
                Doctor          = new Doctor(),
                Departments     = db.Department.ToList()
            };

            return(View(collection));
        }
        public ActionResult AddPsychologist()
        {
            var collection = new DoctorCollection
            {
                ApplicationUser = new RegisterViewModel(),
                Psychologist    = new Psychologist(),
                Centres         = db.Centre.ToList()
            };

            return(View(collection));
        }
        public async Task <ActionResult> AddPsychologist(DoctorCollection model)
        {
            var user = new ApplicationUser
            {
                UserName       = model.ApplicationUser.UserName,
                Email          = model.ApplicationUser.Email,
                UserRole       = "Psychologist",
                RegisteredDate = DateTime.Now.Date
            };
            var result = await UserManager.CreateAsync(user, model.ApplicationUser.Password);

            if (result.Succeeded)
            {
                await UserManager.AddToRoleAsync(user.Id, "Psychologist");

                var psychologist = new Psychologist
                {
                    FirstName    = model.Psychologist.FirstName,
                    LastName     = model.Psychologist.LastName,
                    FullName     = "Dr. " + model.Psychologist.FirstName + " " + model.Psychologist.LastName,
                    EmailAddress = model.ApplicationUser.Email,
                    ContactNo    = model.Psychologist.ContactNo,
                    PhoneNo      = model.Psychologist.PhoneNo,

                    Education         = model.Psychologist.Education,
                    DepartmentId      = model.Psychologist.DepartmentId,
                    Specialization    = model.Psychologist.Specialization,
                    Gender            = model.Psychologist.Gender,
                    ApplicationUserId = user.Id,
                    DateOfBirth       = model.Psychologist.DateOfBirth,
                    Address           = model.Psychologist.Address,
                    Status            = model.Psychologist.Status
                };
                db.Psychologists.Add(psychologist);
                db.SaveChanges();

                string audiuserName = User.Identity.GetUserName();
                AuditExtension.AddAudit(audiuserName, "Added Psychologist", "psychologists");

                return(RedirectToAction("ListOfPsychologists"));
            }

            return(RedirectToAction("ListOfPsychologists"));
        }
Exemplo n.º 7
0
        public async Task <ActionResult> AddDoctor(DoctorCollection model)
        {
            var user = new ApplicationUser
            {
                UserName       = model.ApplicationUser.UserName,
                Email          = model.ApplicationUser.Email,
                UserRole       = "Doctor",
                RegisteredDate = DateTime.Now.Date
            };
            var result = await UserManager.CreateAsync(user, model.ApplicationUser.Password);

            if (result.Succeeded)
            {
                await UserManager.AddToRoleAsync(user.Id, "Doctor");

                var doctor = new Doctor
                {
                    FirstName         = model.Doctor.FirstName,
                    LastName          = model.Doctor.LastName,
                    FullName          = "Dr. " + model.Doctor.FirstName + " " + model.Doctor.LastName,
                    EmailAddress      = model.ApplicationUser.Email,
                    ContactNo         = model.Doctor.ContactNo,
                    PhoneNo           = model.Doctor.PhoneNo,
                    Designation       = model.Doctor.Designation,
                    Education         = model.Doctor.Education,
                    DepartmentId      = model.Doctor.DepartmentId,
                    Specialization    = model.Doctor.Specialization,
                    Gender            = model.Doctor.Gender,
                    BloodGroup        = model.Doctor.BloodGroup,
                    ApplicationUserId = user.Id,
                    DateOfBirth       = model.Doctor.DateOfBirth,
                    Address           = model.Doctor.Address,
                    Status            = model.Doctor.Status
                };
                db.Doctors.Add(doctor);
                db.SaveChanges();
                return(RedirectToAction("ListOfDoctors"));
            }

            return(HttpNotFound());
        }
        public ActionResult EditPsychologists(int id, DoctorCollection model)
        {
            var psychologist = db.Psychologists.Single(c => c.Id == id);

            psychologist.FirstName      = model.Psychologist.FirstName;
            psychologist.LastName       = model.Psychologist.LastName;
            psychologist.FullName       = "Dr. " + model.Psychologist.FirstName + " " + model.Psychologist.LastName;
            psychologist.ContactNo      = model.Psychologist.ContactNo;
            psychologist.PhoneNo        = model.Psychologist.PhoneNo;
            psychologist.Education      = model.Psychologist.Education;
            psychologist.DepartmentId   = model.Psychologist.DepartmentId;
            psychologist.Specialization = model.Psychologist.Specialization;
            psychologist.Gender         = model.Psychologist.Gender;
            psychologist.BloodGroup     = model.Psychologist.BloodGroup;
            psychologist.DateOfBirth    = model.Psychologist.DateOfBirth;
            psychologist.Address        = model.Psychologist.Address;
            psychologist.Status         = model.Psychologist.Status;
            db.SaveChanges();

            return(RedirectToAction("ListOfPsychologists"));
        }
Exemplo n.º 9
0
        public ActionResult EditDoctors(int id, DoctorCollection model)
        {
            var doctor = db.Doctors.Single(c => c.Id == id);

            doctor.FirstName      = model.Doctor.FirstName;
            doctor.LastName       = model.Doctor.LastName;
            doctor.FullName       = "Dr. " + model.Doctor.FirstName + " " + model.Doctor.LastName;
            doctor.ContactNo      = model.Doctor.ContactNo;
            doctor.PhoneNo        = model.Doctor.PhoneNo;
            doctor.Designation    = model.Doctor.Designation;
            doctor.Education      = model.Doctor.Education;
            doctor.DepartmentId   = model.Doctor.DepartmentId;
            doctor.Specialization = model.Doctor.Specialization;
            doctor.Gender         = model.Doctor.Gender;
            doctor.BloodGroup     = model.Doctor.BloodGroup;
            doctor.DateOfBirth    = model.Doctor.DateOfBirth;
            doctor.Address        = model.Doctor.Address;
            doctor.Status         = model.Doctor.Status;
            db.SaveChanges();

            return(RedirectToAction("ListOfDoctors"));
        }
Exemplo n.º 10
0
        public async Task <Doctor> GetDoctorAsync(string userName, string password)
        {
            try
            {
                DoctorCollection doctorCollection = await LoadDoctors();

                IEnumerable <Doctor> possibleMatches = doctorCollection.doctors.Where(x => x.UserName == userName && x.Password == password);

                if (possibleMatches != null)
                {
                    if (possibleMatches.Count() > 0)
                    {
                        return(possibleMatches.First());
                    }
                    return(null);
                }
                return(null);
            }
            catch
            {
                return(null);
            }
        }