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)); }
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)); }
public ActionResult CreateIllnessResult(SharedModels.IllnessModel illModel) { illModel.Date = DateTime.Now; // illModel.IdPatient = id; WcfController.addIlnnessToDb(illModel); return(RedirectToAction("PatientDetails", new { id = illModel.IdPatient })); }
public ActionResult Survey(SurveyModel model) { ViewBag.Message = "Wstępna diagnoza chorób"; WcfController.saveSurvey(new EntityModels.Output { Answer = model.responses }); return(RedirectToAction("Index", "Home")); }
public ActionResult PatientsIlnessPartial(int id) { ViewBag.Message = "Choroby pacjenta:"; return(PartialView(WcfController.getIllness(id))); }
public ActionResult MeasuresPartial(int id) { ViewBag.Message = "Pomiary pacjenta:"; return(PartialView(WcfController.getMeasures(id))); }
public ActionResult PatientDetails(int id) { ViewBag.Message = "Szczegóły pacjenta:"; return(View(WcfController.getPatient(id))); }
public ActionResult Patients() { ViewBag.Message = "Dane pacjentów"; return(View(WcfController.getAllPatients().AsEnumerable())); }
// GET api/Illness/5 public IEnumerable <SharedModels.IllnessModel> Get(int id) { return(WcfController.getIllness(id)); }