public async Task <ActionResult> Login(LoginViewModel model, string returnUrl) { if (!ModelState.IsValid) { return(View(model)); } // This doesn't count login failures towards account lockout // To enable password failures to trigger account lockout, change to shouldLockout: true var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout : false); switch (result) { case SignInStatus.Success: var user = UserManager.FindById(User.Identity.GetUserId <int>()); //if (user.Id==1) //{ // return RedirectToAction("HomeAdmin", "Home"); //} ClientService cs = new ClientService(); ApplicantService aps = new ApplicantService(); RessourceService rs = new RessourceService(); if (rs.RessourceExist(user.Id)) { return(RedirectToAction("HomeRessource", "Home")); } else if (aps.ApplicantExist(user.Id)) { return(RedirectToAction("HomeApplicant", "Home")); } else if (cs.ClientExist(user.Id)) { return(RedirectToAction("HomeClient", "Home")); } else { return(RedirectToAction("HomeAdmin", "Home")); } case SignInStatus.LockedOut: return(View("Lockout")); case SignInStatus.RequiresVerification: return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe })); case SignInStatus.Failure: default: ModelState.AddModelError("", "Invalid login attempt."); return(View(model)); } }
// GET: A public async System.Threading.Tasks.Task <ActionResult> Index() { ITestService ts = new TestService(); IRessourceService rs = new RessourceService(); //ts.getProf(); var x = ts.nbByCountry(); //ViewBag.count = 20; double b; List <KeyValuePair <RessourceVM, double> > flist = new List <KeyValuePair <RessourceVM, double> >(); foreach (ressource r in rs.getRessources()) { listWS = new List <KeyValuePair <RessourceVM, string> >(); RessourceVM rVM = new RessourceVM { id = r.id, Name = r.user.name, LastName = r.user.lastname }; HttpClient Client = new HttpClient(); Client.BaseAddress = new Uri("http://localhost:18080/l4c_map-v2-web/"); Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response = await Client.GetAsync("rest/efficiencies?id=" + r.id); string data = await response.Content.ReadAsStringAsync(); JavaScriptSerializer JSserializer = new JavaScriptSerializer(); listWS = ListToDictionary(JSserializer.Deserialize <List <List <Object> > >(data)); string actStr = listWS[0].Value; if (actStr.Contains("%")) { actStr = actStr.Remove(actStr.IndexOf("%"), 1); System.Diagnostics.Debug.WriteLine(actStr); b = double.Parse(actStr, System.Globalization.CultureInfo.InvariantCulture); } else { b = 0; } ract = new KeyValuePair <RessourceVM, double>(rVM, b); flist.Add(ract); } ViewBag.listOfPair = flist; return(View()); }
public CompetenceController() { cs = new CompetenceService(); rs = new RessourceService(); }
public VacanceController() { vs = new VacanceService(); rs = new RessourceService(); }
public RessourcesController() { serviceRessource = new RessourceService(); serviceOrganization = new OrganizationalService(); }