public async Task <IActionResult> MissedEventRequest(MissedEventRequestViewModel model) { DateTime date = model.Time; if (ModelState.IsValid && date.DayOfWeek != DayOfWeek.Saturday && date.DayOfWeek != DayOfWeek.Friday) { if (await IsNewRequestConflicting(date, model.UserID, model.Event)) { TempData["StatusMessage"] = "already requested edit event at this date"; } else { await missedEventRequestRepository.Add(new MissedEventRequest { UserID = model.UserID, Time = model.Time, Event = model.Event, Comment = model.Comment }); TempData["StatusMessage"] = "Your request has been sent to the admin."; return(RedirectToAction("MissedEventRequests")); } } TempData["StatusMessage"] = "Error: Some fields are invalid!"; return(View(model)); }
public IActionResult MissedEventRequest() { MissedEventRequestViewModel missedEventRequestViewModel = new MissedEventRequestViewModel { UserID = User.FindFirst(ClaimTypes.NameIdentifier).Value }; return(View(missedEventRequestViewModel)); }