public void OnGet() { var userId = _userLoginStatusService.GetLoggedInUserId(); var filteredEventsById = _eventStore.GetByDescriptionForUser(SearchTerm, userId); var result = filteredEventsById .Select(@event => EventMapper.MapToViewModel(@event)) .ToList(); Events = result; }
public IActionResult OnPost() { if (!ModelState.IsValid) { Priorities = _htmlHelper.GetEnumSelectList <PriorityType>(); return(Page()); } if (Event.Id > 0) { _eventStore.Update(EventMapper.MapFromViewModel(Event)); } else { Event.UserId = _userLoginStatusService.GetLoggedInUserId(); _eventStore.Add(EventMapper.MapFromViewModel(Event)); } TempData["Message"] = "Events saved!"; return(RedirectToPage("./Events", new { eventId = Event.Id })); }