public ActionResult Index(Person person) { if (Request.IsAuthenticated) { string username = User.Identity.Name; using (var ent = new EHealthDB2Entities()) { person = ent.Person.Where(p => p.username == username).Include(p => p.City).Include(p => p.City1). Include(p => p.PhoneNumber).Include(p => p.PhoneNumber.Select(t => t.PhoneType)). Include(p => p.Email).FirstOrDefault(); } } return(View(person)); }
private bool isValid(String username, String password) { //var crypto = new SimpleCrypto.PBKDF2(); bool isValid = false; using (var ent = new EHealthDB2Entities()) { var person = ent.Person.FirstOrDefault(p => p.username == username); if (person != null) { if (person.password == password /*crypto.Compute(password, osoba.Salt)*/) { isValid = true; } } } return(isValid); }
// // GET: /Application/ // // GET: /Application/ protected override void OnActionExecuted(ActionExecutedContext filterContext) { if (User != null) { var username = User.Identity.Name; if (!string.IsNullOrEmpty(username)) { using (EHealthDB2Entities ent = new EHealthDB2Entities()) { IQueryable <Person> person = from p in ent.Person where p.username == username select p; string fullName = null; foreach (Person p in person) { fullName = p.firstName + " " + p.lastName; } ViewData.Add("FullName", fullName); } } } base.OnActionExecuted(filterContext); }