public async Task <IViewComponentResult> InvokeAsync(string eventId, string day, string hour) { var calEvent = new CalendarEvent(); if (string.IsNullOrEmpty(eventId)) { calEvent = _calendarQueryService.GetDefaultModel(); if (!string.IsNullOrEmpty(day)) { //fix selected date and time before parsing calEvent.EventStart = DateTime.Parse(day.Replace('~', '/') + ' ' + hour.Replace('~', ' ')); calEvent.EventEnd = calEvent.EventStart.AddMinutes(30); } } else { calEvent = _calendarQueryService.GetEventById(eventId); } foreach (var refObject in calEvent.EventGroupEvents) { refObject.Event = null; } return(View(calEvent)); }
public IActionResult EditPost(string id) { var model = _calendarQueryService.GetEventById(id); if (model == null) { model = _calendarQueryService.GetDefaultModel(); } ViewData["masterId"] = "123456"; return(View("~/Views/Admin/Calendar/EditEvent.cshtml", model)); }