public static HtmlTag RenderConcertCard(this IHtmlHelper hmtl, LocalConcert lc) { var card = new HtmlTag("div").AddClass("card card-transparent"); var img1 = new HtmlTag("img", card).AddClass("card-img-top d-lg-none").Attr("height", 320) .Attr("src", lc.FlyerUrl).Attr("width", 200) .Attr("alt", "..."); var img2 = new HtmlTag("img", card).AddClass("card-img-top d-none d-lg-block").Attr("height", 600) .Attr("src", lc.FlyerUrl).Attr("width", 200) .Attr("alt", "..."); var body1 = new HtmlTag("div", card).AddClass("card-body"); var h5 = new HtmlTag("h5", body1).AddClass("card-title text-light mx-auto").Text(lc.Artists); var p = new HtmlTag("p", body1).AddClass("card-text text-light").Text(lc.VenueName); var ul = new HtmlTag("ul", card).AddClass("list-group list-group-flush"); var li1 = new HtmlTag("li", ul).AddClass("list-group-item make-transparent text-light") .Text(lc.TimeStart.ToLongDateString() + " at " + lc.TimeStart.TimeOfDay); var li2 = new HtmlTag("li", ul).AddClass("list-group-item make-transparent text-light"); // var a = new HtmlTag("a", li2).AddClass("btn btn-dark") // .Attr("href", "/Home/Comments?eventid=" + lc.EventConcertId) // .Text("Comments"); var a = new HtmlTag("a", li2).AddClass("btn btn-dark nav-link comment-show-button") .Attr("data-widget", "pushmenu") .Text("Comments") .Id(lc.EventConcertId.ToString()) .Attr("onclick", "showCommentsForEvent(this.id); changeCommentSectionName('" + lc.Artists + "')"); return(card); }
public async Task <IActionResult> AddToApprovalTrusted(LocalConcert localConcert) { //check if file length is too long if (localConcert.FlyerFile.Length > 6000000) { ModelState.AddModelError("File", $"The request couldn't be processed (File size exceeded)."); // Log error return(BadRequest(ModelState)); } if (ModelState.IsValid) { // Scan and upload file localConcert.FlyerUrl = await _storageService.StoreImageFile(localConcert.FlyerFile); // Get user id ClaimsPrincipal currentUser = User; string currentUserId = currentUser.FindFirst(ClaimTypes.NameIdentifier).Value; // Add date to queue; admin must then approve _dbAccessLogic.CreateQueuedDate(localConcert, currentUserId); // _dbAccessLogic.CreateQueuedDate(localConcert, "371217ea-6458-40eb-ace7-4d5c83df2469"); return(Ok()); } return(BadRequest()); }
// Tested and working public int CreateQueuedDate(LocalConcert localConcert, string userId) { bool nullTimeEnd = localConcert.TimeEnd == DateTime.MinValue; var end = localConcert.TimeEnd; return(_dataAccessService.ExecuteProcedureAsync("InsertConcertToApprovalQueue", null, Pairing.Of("@userId", userId), Pairing.Of("@event", localConcert.Artists), Pairing.Of("@venueName", localConcert.VenueName), Pairing.Of("@timeStart", localConcert.TimeStart), Pairing.Of("@flyerurl", localConcert.FlyerUrl), Pairing.Of("@timeend", (nullTimeEnd) ? null : end)).Result); }
public async Task <IActionResult> AddConcertAjax(LocalConcert localConcert) { if (ModelState.IsValid) { localConcert.FlyerUrl = await _storageService.StoreImageFile(localConcert.FlyerFile); var dictionary = _dbAccessLogic.CreateConcertDate(localConcert); // 0 : parent row Id(event), 1: child row id (concert) return(Json(dictionary)); } return(BadRequest()); }
// Admin create concert public int CreateConcertDate(LocalConcert localConcert) { bool nullTimeEnd = localConcert.TimeEnd == DateTime.MinValue; var end = localConcert.TimeEnd; // 0 : parent row Id(event), 1: child row id (concert) return(_dataAccessService.ExecuteProcedureAsync("InsertLocalConcert", "@concertId", Pairing.Of("@artists", localConcert.Artists), Pairing.Of("@flyerurl", localConcert.FlyerUrl), Pairing.Of("@timestart", localConcert.TimeStart), Pairing.Of("@timeend", (nullTimeEnd) ? null : end), Pairing.Of("isapproved", localConcert.IsApproved), Pairing.Of("@venue", localConcert.VenueName) ).Result); }