public ActionResult Details(int s) { ResultViewModel model = new ResultViewModel(); var service = _services.GetService(s); var user = _membership.GetUser(service.UserId); var ratings = _ratings.GetServiceRatings(s); if (service != null && user != null) { model.ServiceId = service.Id; model.ServiceName = service.Name; model.ServiceDescription = service.Description; model.ServiceLocation = service.Location; model.ServiceLinkToProfile = service.LinkToProfile; model.ServiceSendToMessenger = service.SendToMessenger; model.UserId = user.Id; model.UserName = user.Name; model.UserLocation = user.Location; model.UserContactNumber = user.ContactNumber; model.UserNameIdentifier = user.NameIdentifier; model.PositiveRatings = ratings.Where(r => r.Rating == true).Count(); model.NegativeRatings = ratings.Where(r => r.Rating == false).Count(); if (User.Identity.IsAuthenticated) { var loginId = _membership.GetUserId(User.Identity.Name); var hasRatings = ratings.Where(r => r.LoginId == loginId).Count(); if (hasRatings > 0) { model.RatingGiven = true; } model.LoginId = loginId; } } return(View(model)); }
public JsonResult GetMyService(int ServiceId) { var model = _services.GetService(ServiceId); return(Json(model, JsonRequestBehavior.AllowGet)); }