예제 #1
0
        public ActionResult Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            SHA256Managed crypt = new SHA256Managed();

            byte[] crypto = crypt.ComputeHash(Encoding.ASCII.GetBytes(model.Password), 0,
                                              Encoding.ASCII.GetByteCount(model.Password));

            if (WcfController.authenticateUser(model.Email, crypto))
            {
                Security.SessionPersister.Username = model.Email;

                if (null != returnUrl)
                {
                    return(Redirect(returnUrl));
                }
                else
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }

            ModelState.AddModelError("IncorrectData", "Email i hasło nie pasują do siebie!");
            return(View(model));
        }
예제 #2
0
        public ActionResult Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var result = WcfController.checkIfExist(model.Email);

                if (result)
                {
                    ModelState.AddModelError("Email", "Istnieje już taki użytkownik!");
                    return(View(model));
                }

                SHA256Managed crypt  = new SHA256Managed();
                byte[]        crypto = crypt.ComputeHash(Encoding.ASCII.GetBytes(model.Password), 0,
                                                         Encoding.ASCII.GetByteCount(model.Password));


                WcfController.createPatient(new EntityModels.User {
                    Pass  = crypto,
                    Email = model.Email, Surname = model.SurName, FstName = model.FirstName
                });

                return(RedirectToAction("Index", "Home"));
            }
            // If we got this far, something failed, redisplay form
            return(View(model));
        }
예제 #3
0
 public ActionResult CreateIllnessResult(SharedModels.IllnessModel illModel)
 {
     illModel.Date = DateTime.Now;
     //  illModel.IdPatient = id;
     WcfController.addIlnnessToDb(illModel);
     return(RedirectToAction("PatientDetails", new { id = illModel.IdPatient }));
 }
예제 #4
0
        public ActionResult Survey(SurveyModel model)
        {
            ViewBag.Message = "Wstępna diagnoza chorób";
            WcfController.saveSurvey(new EntityModels.Output
            {
                Answer = model.responses
            });

            return(RedirectToAction("Index", "Home"));
        }
예제 #5
0
 public ActionResult PatientsIlnessPartial(int id)
 {
     ViewBag.Message = "Choroby pacjenta:";
     return(PartialView(WcfController.getIllness(id)));
 }
예제 #6
0
 public ActionResult MeasuresPartial(int id)
 {
     ViewBag.Message = "Pomiary pacjenta:";
     return(PartialView(WcfController.getMeasures(id)));
 }
예제 #7
0
 public ActionResult PatientDetails(int id)
 {
     ViewBag.Message = "Szczegóły pacjenta:";
     return(View(WcfController.getPatient(id)));
 }
예제 #8
0
 public ActionResult Patients()
 {
     ViewBag.Message = "Dane pacjentów";
     return(View(WcfController.getAllPatients().AsEnumerable()));
 }
예제 #9
0
 // GET api/Illness/5
 public IEnumerable <SharedModels.IllnessModel> Get(int id)
 {
     return(WcfController.getIllness(id));
 }