Exemplo n.º 1
0
        public void Insert(PatientViewModel patientModel)
        {
            using (var repo = new PatientRepository())
            {
                var dis = new Patient();
                if (true)
                {
                    dis.PatientId = patientModel.PatientId;

                    dis.UserName = patientModel.UserName;
                    dis.FirstName = patientModel.FirstName;
                    dis.LastName = patientModel.LastName;
                    dis.IdentificationNumber = patientModel.IdentificationNumber;
                    dis.Cellphone = patientModel.Cellphone;
                    dis.Email = patientModel.Email;
                    dis.Occupation = patientModel.Occupation;
                    dis.SecurityAnswer = patientModel.SecurityAnswer;
                    dis.Address = patientModel.Address;
                    dis.Telephone = patientModel.Telephone;
                    dis.City = patientModel.City;
                    dis.State = patientModel.State;
                    dis.Country = patientModel.Country;
                    dis.ZipCode = patientModel.ZipCode;

                }
                repo.Insert(dis);
                AddUserToPatientRole(dis.UserName);
            }
        }
Exemplo n.º 2
0
 public void Delete(PatientViewModel patientModel)
 {
     using (var repo = new PatientRepository())
     {
         var dis = new Patient();
         dis = repo.GetById(patientModel.PatientId);
         repo.Delete(dis);
     }
 }
Exemplo n.º 3
0
        public ActionResult MyDetails(PatientViewModel model, string username)
        {
            try
            {
                if (!ModelState.IsValid) return View(model);
                model.UserName = username;
                obj.Update(model);

                return RedirectToAction("MyAccount");
            }
            catch
            {
                return View(model);
            }
        }
Exemplo n.º 4
0
        //[CaptchaMvc.Attributes.CaptchaVerify("Incorrect captcha text")]
        public async Task<ActionResult> SignUp(SignUpViewModel objSignUpViewModel, bool captchaValid)
        {
            PatientViewModel patient=new PatientViewModel();
            if (ModelState.IsValid)
            {
                var signUpbusiness = new SignUpBusiness();

                if (signUpbusiness.FindUser(objSignUpViewModel.UserName, AuthenticationManager))
                {
                    ModelState.AddModelError("", "User already exists");
                    return View(objSignUpViewModel);
                }

                var result = await signUpbusiness.SignUpUser(objSignUpViewModel, AuthenticationManager);

                patient.UserName = objSignUpViewModel.UserName;
                patient.IdentificationNumber = "";
                patient.FirstName = objSignUpViewModel.FirstName;
                patient.LastName = objSignUpViewModel.LastName;

                patient.Cellphone = objSignUpViewModel.Cell;
                patient.Email = objSignUpViewModel.EmailAddress;
                patient.Occupation = "";
                patient.SecurityQuestion = objSignUpViewModel.SecurityQuestion;
                patient.SecurityAnswer = objSignUpViewModel.SecurityAnswer;

                _client.Insert(patient);


                if (result)
                {
                    return RedirectToAction("Index", "Home");
                }
                else
                {
                    ModelState.AddModelError("", result.ToString());
                }
            }
            return View(objSignUpViewModel);
            }
Exemplo n.º 5
0
        public void Insert(BookingModel bookingModel)
        {
            using (var repo = new BookingRepository())
            {
                PatientViewModel pa = new PatientViewModel();
                var dis = new Booking();
                if (true)
                {
                    //dis.BookingID = bookingModel.BookingID;

                    dis.Username = bookingModel.Username;
                    dis.BranchName = bookingModel.BranchName;
                    dis.OptometristName = bookingModel.OptometristName;
                    dis.BookedTime = bookingModel.BookedTime;
                    dis.BookedDate = bookingModel.BookedDate;
                    dis.Status = bookingModel.Status;

                    dis.TotalCost = bookingModel.TotalCost;

                }
                repo.Insert(dis);
            }
        }
Exemplo n.º 6
0
        //2 convert
        private static Patient ConvertToViewModel(PatientViewModel model)
        {
            var ash = new Patient
            {
                Cellphone = model.Cellphone,
                Email = model.Email,
                FirstName = model.FirstName,
                SecurityAnswer = model.SecurityAnswer,
                IdentificationNumber = model.IdentificationNumber,
                LastName = model.LastName,
                Occupation = model.Occupation,
                PatientId = model.PatientId,
                SecurityQuestion = model.SecurityQuestion,
                UserName = model.UserName,
                Address = model.Address,
                Telephone = model.Telephone,
                City = model.City,
                State = model.State,
                Country = model.Country,
                ZipCode = model.ZipCode

            };
            return ash;
        }
Exemplo n.º 7
0
 public void UpdatePatient(PatientViewModel patientModel)
 {
     ApplicationDbContext db = new ApplicationDbContext();
        var user = db.Users.First(x => x.UserName == patientModel.UserName);
        user.Email = patientModel.Email;
        user.FirstName = patientModel.FirstName;
        user.LastName = patientModel.LastName;
        db.Entry(user).State = EntityState.Modified;
        db.SaveChangesAsync();
 }
Exemplo n.º 8
0
        public ActionResult Edit(PatientViewModel patientModel, string username)
        {
            try
            {
                if (!ModelState.IsValid) return View(patientModel);

                //clientview.houseNumber = clientview.AddressName.Substring(0, clientview.AddressName.IndexOf(' '));
                //clientview.StreetName = clientview.AddressName.Substring(clientview.AddressName.IndexOf(' ') + 1, clientview.AddressName.IndexOf(',') - 2);
                //string x = clientview.AddressName.Substring(clientview.AddressName.IndexOf(',') + 2);
                //clientview.Suburb = x.Substring(0, x.IndexOf(','));
                _patient.UpdatePatient(patientModel);
                return RedirectToAction("Index", "Home");
            }
            catch
            {
                return View();
            }
        }