public ActionResult Login(LoginModel model, string returnUrl) { var personModel = _personsService.GetSingle(model.UserName); if (personModel != null && !personModel.IsBlocked) { if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, model.RememberMe)) { return(RedirectToLocal(returnUrl)); } ModelState.AddModelError("", "Neteisingai įvestas slaptažodis arba vartotojo vardas."); } else { ModelState.AddModelError("", "Vartotojas blokuotas sistemoje!"); } // If we got this far, something failed, redisplay form return(View(model)); }
// GET: Vartotojai/Details/5 public ActionResult Details(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var personModel = _personsService.GetSingle((Guid)id); if (personModel == null) { return(HttpNotFound()); } var personViewModel = new PersonViewModel { IdPerson = personModel.IdPerson, Name = personModel.Name, Address = personModel.Address, Birthday = personModel.Birthday, Email = personModel.Email, LastName = personModel.LastName, MobilePhone = personModel.MobilePhone, UserName = personModel.UserName, IsBlocked = personModel.IsBlocked }; var organizationEntity = _organizationService.GetSingle(personModel.IdOrganization); if (organizationEntity != null) { personViewModel.Organization = new OrganizationViewModel { Name = organizationEntity.Name, IdOrganization = organizationEntity.IdOrganization }; } return(View(personViewModel)); }