public ActionResult Create(EditableMeetingViewModel model)
        {
            if (!ModelState.IsValid)
            {
                model.Locations =
                    _locationRepository
                    .GetLocations()
                    .Select(location => new SelectListItem
                {
                    Value = location.Id.ToString(),
                    Text  = location.Name
                })
                    .ToList();

                return(View(model));
            }

            var meeting = Mapper.Map <MeetingViewModel, Meeting>(model.Event);

            if (meeting != null && _meetingRepository.CreateMeeting(meeting))
            {
                return(RedirectToAction("Index"));
            }

            return(View());
        }
Esempio n. 2
0
        public void createMeeting(MeetingModel meetingModel)
        {
            var meeting = new Meeting {
                Title = meetingModel.Title, Start = meetingModel.Start, End = meetingModel.End, Location = meetingModel.Location, Priority = meetingModel.Priority, creator = meetingModel.creator
            };
            var result = _repository.CreateMeeting(meeting);

            foreach (var participant in meetingModel.participants)
            {
                var notification = new MeetingRequest {
                    Meeting = result, Content = "Do you want to accept request for " + meetingModel.Title, Status = false, User = participant
                };
                _repositoryMR.createMeetingRequest(notification);
            }
        }
        public async Task Post([FromBody] MeetingViewModel meetingViewModel)
        {
            var meetingEntity = _mapper.Map <Meetings>(meetingViewModel);

            meetingEntity.IsTentative = false;
            meetingEntity.CreatedDate = DateTime.Now;
            meetingEntity.CreatedBy   = (int)meetingEntity.OrganizerId;
            meetingEntity.MeetingType = 0;

            var meetingModel = await _meetingRepository.CreateMeeting(meetingEntity);

            if (meetingModel != null)
            {
                await _synchubContext.Clients.All.SendAsync("SendMeetingData", meetingModel);
            }
        }