public async Task <IActionResult> MeetingOwnInfo(int meetingId) { var userId = _userManager.GetUserId(User); var ownership = await _meetingQuery.CheckMeetingOwnerAsync(meetingId, userId); if (ownership == false) { RedirectPermanent(Url.Action("Index", "Home")); } var meeting = await _meetingQuery.GetMeetingByIdAsync(meetingId); var model = new MeetingOwnInfoViewModel { 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), UnconfirmedUsersRequests = await _meetingQuery.GetMeetingUnconfirmedUsersCountAsync(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)); }