/// <summary> /// affiche le liste des prestataires /// </summary> /// <returns></returns> public async Task <ActionResult> presta() { var prest = new List <PrestaViewModel>(); foreach (var item in db.ServiceProviders.ToList()) { var user = UserManager.FindByEmail(item.Email); var rolesForUser = UserManager.GetRoles(user.Id); if (rolesForUser.Contains("ServiceProvider") && user != null && item.Domain != null && item.sector != null) { PrestaViewModel ps = new PrestaViewModel(); ps.domain = item.Domain.Name; ps.sector = item.sector.Name; ps.photoLink = item.photoLink; ps.stars = item.Stars; ps.titre = item.Titre; ps.fullName = item.FullName; ps.Nstars = 5 - item.Stars; if (ps.photoLink == null) { ps.photoLink = "~/Content/Images/Unknown.png"; } if (item.Diponibility == false) { ps.dispo = "Non Disponible"; } else { ps.dispo = "Disponible"; } prest.Add(ps); } } ViewBag.photoLink = await getPicLink(); return(View(prest)); }
/// <summary> /// Shows the list of service providers in our platform /// </summary> /// <returns></returns> public ActionResult prestaList() { if (Request.IsAuthenticated) { /*fixed tonight , replace reception by missions and everything is gonna be fine*/ return(RedirectToAction("Presta", "Missions")); } var prest = new List <PrestaViewModel>(); foreach (var item in db.ServiceProviders.ToList()) { if (item.Domain != null && item.sector != null) { PrestaViewModel ps = new PrestaViewModel(); ps.domain = item.Domain.Name; ps.sector = item.sector.Name; ps.photoLink = item.photoLink; ps.stars = item.Stars; ps.fullName = item.FullName; ps.Nstars = 5 - item.Stars; if (ps.photoLink == null) { ps.photoLink = "~/Content/Images/Unknown.png"; } if (item.Diponibility == false) { ps.dispo = "Non Disponible"; } else { ps.dispo = "Disponible"; } prest.Add(ps); } } return(View(prest)); }