// GET: Sponsors/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Sponsor sponsor = await sponsorsLogic.GetSponsorById(id.Value); if (sponsor == null) { return(HttpNotFound()); } return(View(sponsor)); }
public async Task <ActionResult> SponserById(string Token, int id, int eventID) { SponsorsLogic attendesBusiness = new SponsorsLogic(); EventLogic eventLogic = new EventLogic(); var x = await attendesBusiness.GetSponsorById(id); var sponsorsEvent = x.SponsorsEvents.FirstOrDefault(y => y.EventID == eventID); var SponsorQuestions = await eventLogic.SponsorSurveyQuestions(CurrentUserSession.AttendesID.Value, id); var floorMapping = sponsorsEvent?.FloorMapLocation?.FloorRegionMappings.FirstOrDefault(); return(Json(new { data = new { x.ID, x.Name, x.Description, x.DocURL, x.WebsiteURL, Thumbnail = imageToUrlConvertionHandler(x.Thumbnail), //Helpers.ImageToBase64(MvcCustom.APiImagePath(x.Thumbnail)), x.Status, SponsorPackageType = x.SponsorsEvents.FirstOrDefault(y => y.EventID == eventID)?.UserPackageType?.Name, Documents = x.Documents.Select(y => new { y.ID, y.DocumentName, FilePath = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, MvcCustom.ApiDocumentPath(y.FilePath)) }), sponsorsEvent?.BoothNo, sponsorsEvent?.StartTime, sponsorsEvent?.EndTime, SurveyQuestions = SponsorQuestions.Select(a => new QuestionsWithOptions { QID = a.QID, QuestionText = a.QuestionText, IsAtActiivtyLevel = a.IsAtActiivtyLevel, QuestionResponseType = a.QuestionResponseType, HideorShowQuestion = a.HideorShowQuestion, options = a.options, IsSubmitted = a.IsSubmitted, IsAtVendorLevel = a.IsAtVendorLevel, IsAtSponsorLevel = a.IsAtSponsorLevel }), Note = x.Notes.FirstOrDefault(y => y.UserID == CurrentUserSession.AttendesID.Value && y.EventID == eventID)?.Text, FloorMap = floorMapping != null ? new { floorMapping?.FloorMapping?.ID, FloorName = sponsorsEvent?.FloorMapLocation?.Location } : null, Activities = x.SponsorActivities.Select(y => y.Activite).Select(y => new { y.ID, y.Name, y.StartTime, y.EndTime }), Speakers = x.SponsorActivities.SelectMany(y => y.Activite.BookMarks.Select(z => z.Attende)) .Where(y => y.IsSpeaker).Distinct(new AttendeeComparer()). Select(y => new { y.FirstName, y.Lastname, y.TitleName, Thubnail = compressedImageConvertionHandler(y.Thumbnail) }) } }, JsonRequestBehavior.AllowGet)); }