public async Task <IActionResult> MeetingGeneralInfo(int meetingId) { var meeting = await _meetingQuery.GetMeetingByIdAsync(meetingId); var model = new MeetingGeneralInfoViewModel { Id = meeting.Id, Name = meeting.Name, Description = meeting.Description, CategoryName = (await _meetingQuery.GetMeetingCategoryByIdAsync(meeting.MeetingCategoryId)).Name, CityName = (await _locationQuery.GetCityByIdAsync(meeting.CitiesId)).Name, ConfirmedUsersRequests = await _meetingQuery.GetMeetingConfirmedUsersCountAsync(meeting.Id), PhotoPath = meeting.PhotoPath, ShortDateString = meeting.MeetingDate.ToShortDateString() }; return(View(model)); }
public async Task <IActionResult> MeetingEdit(int meetingId) { var userId = _userManager.GetUserId(User); var checkOwnership = await _meetingQuery.CheckMeetingOwnerAsync(meetingId, userId); if (checkOwnership == false) { return(RedirectPermanent(Url.Action("Index", "MeetingInfo"))); } var meeting = await _meetingQuery.GetMeetingByIdAsync(meetingId); var meetingCategories = await _meetingQuery .GetMeetingCategoriesAsync(); var model = new MeetingEditViewModel { Id = meeting.Id, Name = meeting.Name, Description = meeting.Description, MeetingCategoryId = meeting.MeetingCategoryId, MeetingCategories = meetingCategories, MeetingDate = meeting.MeetingDate, CurrentPhotoPath = meeting.PhotoPath, CityId = meeting.CitiesId }; return(View(model)); }