public async Task <IActionResult> Index()
        {
            var userMeetings = await _meetingQuery.GetLastRegisteredMeetingsAsync(10);

            List <MeetingGeneralInfoViewModel> modelList = new List <MeetingGeneralInfoViewModel>();

            foreach (var item in userMeetings)
            {
                modelList.Add(
                    new MeetingGeneralInfoViewModel
                {
                    Id = item.Id,

                    Name = item.Name,

                    Description = string.Concat(item.Description.Take(15)),

                    CityName = (await _locationQuery.GetCityByIdAsync(item.CitiesId)).Name,

                    CategoryName = (await _meetingQuery.GetMeetingCategoryByIdAsync(item.MeetingCategoryId)).Name,

                    ConfirmedUsersRequests = await _meetingQuery.GetMeetingConfirmedUsersCountAsync(item.Id),

                    PhotoPath = item.PhotoPath,

                    ShortDateString = item.MeetingDate.ToShortDateString()
                });
            }

            return(View(modelList));
        }
        public async Task <IActionResult> MeetingCreate(MeetingCreateViewModel model)
        {
            if (!ModelState.IsValid)
            {
                model.MeetingCategories = await _meetingQuery.GetMeetingCategoriesAsync();

                return(View(model));
            }

            if (await _locationQuery.GetCityByIdAsync(model.CityId) == null)
            {
                ModelState.AddModelError("CityId", "Please choose a city");
                model.MeetingCategories = await _meetingQuery.GetMeetingCategoriesAsync();

                return(View(model));
            }


            string photoPath = await _fileService.SaveImage(model.PhotoPath);

            var userId = _userManager.GetUserId(User);

            var meeting = new Meeting
            {
                Name              = model.Name,
                Description       = model.Description,
                CitiesId          = model.CityId,
                MeetingCategoryId = model.MeetingCategoryId,
                MeetingDate       = model.MeetingDate,
                PhotoPath         = photoPath,
                UserId            = userId,
            };

            var result = await _meetingManager.CreateMeetingAsync(meeting);

            if (result == OperationResult.Failed)
            {
                return(View(model));
            }

            return(RedirectPermanent(Url.Action("Index", "MeetingInfo")));
        }