// blocked patient, normal patient with watch medical, patient w.o watch medical, edit patient, enter setting screen.

        public void UnauthorizedCreatePatient()
        {
            OpenEntityDropdown.ClickOn();
            if (CreateNewPatient.IsDisplayed("patient create button"))
            {
                Console.WriteLine("fail test");
                Assert.Fail();
            }
            else
            {
                Log.Info("create patient isnt availble - Pass test.");
            }
        }
        public ActionResult Create(CreateNewPatient model, HttpPostedFileBase image)
        {
            if (model != null && this.ModelState.IsValid)
            {
                var doctorId = this.User.Identity.GetUserId();
                var patient  = new Patient
                {
                    Name      = model.Name,
                    Age       = model.Age,
                    Gender    = model.Gender,
                    Condition = model.Condition,
                    Status    = model.Status,
                    Room      = model.Room,
                    DoctorId  = doctorId,
                    Id        = model.Id
                };

                if (image != null)
                {
                    var allowedContentTypes = new[] { "image/jpeg", "image/jpg", "image/png" };

                    if (allowedContentTypes.Contains(image.ContentType))
                    {
                        var imagesPath = "/Content/Images/";

                        var fileName     = image.FileName;
                        var uploadPath   = imagesPath + fileName;
                        var physicalPath = Server.MapPath(uploadPath);

                        image.SaveAs(physicalPath);
                        patient.ImagePath = uploadPath;
                    }
                }
                var db = new PatientsDbContext();
                db.Patients.Add(patient);
                db.SaveChanges();

                return(RedirectToAction("Details", new { id = patient.Id }));
            }
            return(View(model));
        }