public async Task <IActionResult> CreateNewMeeting([FromBody] TeacherStudentMeeting newMeeting)
        {
            var meeting = new TeacherStudentMeeting
            {
                AcceptedByTeacher = false,
                Duration          = 120,
                MeetingDate       = new DateTime(2018, 06, 13),
                StudentID         = 1,
                TeacherID         = 2,
                TotalCost         = 40
            };

            try
            {
                //await _context.Meetings.AddAsync(newMeeting);
                await _context.Meetings.AddAsync(meeting);

                await _context.SaveChangesAsync();

                return(CreatedAtAction(nameof(CreateNewMeeting), new { id = meeting.Id }, null));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
        public async Task <IActionResult> Create([Bind("Id,MeetingDate,Conductor,OpeningHymnNumber,SacramentHymnNumber,RestHymnNumber,ClosingHymn,OpeningPrayer,ClosingPrayer,SpeakerOne,SpeakerTwo,SpeakerThree")] Meeting meeting)
        {
            if (ModelState.IsValid)
            {
                _context.Add(meeting);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(meeting));
        }
        public async Task <IActionResult> Create([Bind("ID,FirstName,LastName,Age, Gender, Calling")] Members members)
        {
            if (ModelState.IsValid)
            {
                _context.Add(members);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(members));
        }
        public async Task <IActionResult> Create([Bind("MeetingId,MeetingDate,Conducting,OpenPray,OpenHymn,SacramentHymn,IntermediateHymn,ClosingHymn,ClosingPray")] Meeting meeting)
        {
            if (ModelState.IsValid)
            {
                _context.Add(meeting);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(meeting));
        }
        public async Task <IActionResult> Create([Bind("Id,CN,EmailAddress")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
Beispiel #6
0
        public async Task <IActionResult> Create([Bind("SpeakerID,MeetingID,PersonID,AssignedTopic")] Speaker speaker)
        {
            if (ModelState.IsValid)
            {
                _context.Add(speaker);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(speaker));
        }
        public async Task <IActionResult> Create([Bind("ID,MeetingDate,Presiding,Conducting,IntermediateSong,IntermediateMusicalNumber,Speaker1,Speaker2,Speaker3,Speaker4,Speaker5,Speaker6,Speaker7,OpeningHymn,SacramentHymn,ClosingHymn,OpeningPrayer,ClosingPrayer")] Meetings meetings)
        {
            if (ModelState.IsValid)
            {
                _context.Add(meetings);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(meetings));
        }
        public async Task <IActionResult> Create([Bind("ID,MeetingDate,Conductor,OpeningHymn,OpeningHymnPage,Invocation,SacramentHymn,SacramentHymnPage,IntermediateNumber,ClosingHymn,ClosingHymnPage,Benediction")] Meeting meeting)
        {
            if (ModelState.IsValid)
            {
                _context.Add(meeting);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(meeting));
        }
        public async Task <IActionResult> Create([Bind("Id,Title,EventColor")] Room room)
        {
            if (ModelState.IsValid)
            {
                _context.Add(room);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(room));
        }
Beispiel #10
0
        public async Task <IActionResult> Create([Bind("ID,Topic")] AssignmentTopic assignmentTopic)
        {
            if (ModelState.IsValid)
            {
                _context.Add(assignmentTopic);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(assignmentTopic));
        }
        public async Task <IActionResult> Create([Bind("MeetingID,MeetingDate,Conductor")] Meeting meeting)
        {
            if (ModelState.IsValid)
            {
                _context.Add(meeting);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(meeting));
        }
Beispiel #12
0
        public async Task <IActionResult> Create([Bind("ID,name,artist,book,bookFilter,collectionFilter,url,alturl,mp3,playerlink,pdf,video1,video2,showAsterisk,hasDownload,midi,songid,songNumber,detailColumn")] MyModel myModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(myModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(myModel));
        }
Beispiel #13
0
        public async Task <IActionResult> Create([Bind("PersonID,LastName,FirstMidName,Discriminator")] Person person)
        {
            if (ModelState.IsValid)
            {
                _context.Add(person);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(person));
        }
Beispiel #14
0
        public async Task <IActionResult> Create([Bind("ID,HymnName,PageNumber")] Hymns hymns)
        {
            if (ModelState.IsValid)
            {
                _context.Add(hymns);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(hymns));
        }
        public async Task <IActionResult> Create([Bind("HymnID,MeetingID,Title,Number,Order")] Hymn hymn)
        {
            if (ModelState.IsValid)
            {
                _context.Add(hymn);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(hymn));
        }
Beispiel #16
0
        public async Task <IActionResult> Create([Bind("PrayerID,MeetingID,PrayerName,Order")] Prayer prayer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(prayer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(prayer));
        }
        public async Task <IActionResult> Create([Bind("SacramentMeetingPlanID,Date,OpeningPrayer,ClosingPrayer,OpeningHymn,SacramentHymn,ClosingHymn,Talk1,Talk2,Talk3,Topic,LeaderName,Presiding,Announcements")] SacramentMeetingPlan sacramentMeetingPlan)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sacramentMeetingPlan);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(sacramentMeetingPlan));
        }
        public async Task <IActionResult> Create([Bind("ID,Name")] Ward ward)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ward);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(ward));
        }
Beispiel #19
0
        public async Task <IActionResult> Create([Bind("ID,MeetingDate,ConductingLeader,OpeningSong,OpeningPrayer,SacramentSong,IntermediateSong,ClosingSong,ClosingPrayer")] Meeting meeting)
        {
            if (ModelState.IsValid)
            {
                _context.Add(meeting);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(meeting));
        }
        public async Task <IActionResult> Create([Bind("HymnID,HymnNumber,HymnName")] Hymn hymn)
        {
            if (ModelState.IsValid)
            {
                hymn.HymnID = Guid.NewGuid();
                _context.Add(hymn);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(hymn));
        }
        public async Task <IActionResult> Create([Bind("SpeakerID,BulletinID,Name,Topic")] Speaker speaker)
        {
            if (ModelState.IsValid)
            {
                _context.Add(speaker);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BulletinID"] = new SelectList(_context.Bulletins, "ID", "ID", speaker.BulletinID);
            return(View(speaker));
        }
        public async Task <IActionResult> Create([Bind("SpeakerId,SpeakerName,Subject,MeetingId")] Speaker speaker)
        {
            if (ModelState.IsValid)
            {
                _context.Add(speaker);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MeetingId"] = new SelectList(_context.Meetings, "MeetingId", "MeetingId", speaker.MeetingId);
            return(View(speaker));
        }
Beispiel #23
0
        public async Task <IActionResult> Create([Bind("SpeakingAssignmentID,MeetingID,SpeakerID,Topic")] SpeakingAssignment speakingAssignment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(speakingAssignment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MeetingID"] = new SelectList(_context.Meetings, "ID", "ID", speakingAssignment.MeetingID);
            ViewData["SpeakerID"] = new SelectList(_context.Speakers, "ID", "ID", speakingAssignment.SpeakerID);
            return(View(speakingAssignment));
        }
Beispiel #24
0
        public async Task <IActionResult> Create([Bind("ID,MeetingID,AssignmentTopicID,Name")] Speaker speaker)
        {
            if (ModelState.IsValid)
            {
                _context.Add(speaker);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AssignmentTopicID"] = new SelectList(_context.AssignmentTopics, "ID", "Topic", speaker.AssignmentTopicID);
            ViewData["MeetingID"]         = new SelectList(_context.Meetings, "ID", "MeetingDate", speaker.MeetingID);
            return(View(speaker));
        }
Beispiel #25
0
        public async Task <IActionResult> Create([Bind("MeetingID,MeetingDate,Conducting,OpeningHymn,OpeningPrayer,SacramentHymn,IntermediateSong,ClosingHymn,ClosingPrayer")] Meeting meeting)
        {
            if (ModelState.IsValid)
            {
                _context.Add(meeting);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            PopulateMemberDropDownList(meeting.MeetingID);
            PopulateBishopricDropDownList(meeting.MeetingID);
            PopulateHymnDropDownList(meeting.MeetingID);
            return(View(meeting));
        }
Beispiel #26
0
        public async Task <IActionResult> Create([Bind("ID,Topic,Minutes")] Speaker speaker)
        {
            speaker.Member  = GetSelectedMember("MemberSelect");
            speaker.Meeting = GetSelectedMeeting("MeetingSelect");

            if (ModelState.IsValid)
            {
                _context.Add(speaker);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(speaker));
        }
        public async Task <IActionResult> Create([Bind("ID,MeetingDate,OptionalRestHymnTitle")] Meeting meeting)
        {
            meeting.FastAndTestimonyMeeting = (Request.Form["FastMeeting"].Count > 0);
            meeting.Ward                = GetSelectedWard("WardSelect");
            meeting.Presiding           = GetSelectedMember("PresidingSelect");
            meeting.ConductingLeader    = GetSelectedMember("ConductingSelect");
            meeting.Chorister           = GetSelectedMember("ChoristerSelect");
            meeting.Organist            = GetSelectedMember("OganistSelect");
            meeting.Organist            = GetSelectedMember("OrganistSelect");
            meeting.OpeningHymn         = GetSelectedHymn("OpeningHymnSelect");
            meeting.OpeningPrayerMember = GetSelectedMember("OpeningPrayerSelect");
            if (Request.Form["Announcements"].Count > 0)
            {
                meeting.Announcements = Request.Form["Announcements"][0];
            }
            meeting.SacramentHymn = GetSelectedHymn("SacramentHymnSelect");
            if (Request.Form["RestHymnSelect"].Count > 0)
            {
                meeting.OptionalRestHymnTitle = Request.Form["RestHymnSelect"][0];
            }
            meeting.OptionalRestHymnMember = GetSelectedMember("RestHymnMemberSelect");
            meeting.ClosingHymn            = GetSelectedHymn("ClosingHymnSelect");
            meeting.ClosingPrayerMember    = GetSelectedMember("ClosingPrayerSelect");

            if (ModelState.IsValid)
            {
                _context.Add(meeting);
                await _context.SaveChangesAsync();

                // Add Speakers
                int count = Request.Form["SpeakerMember"].Count;
                for (int i = 0; i < count; i++)
                {
                    Speaker s = new Speaker
                    {
                        Meeting = meeting,
                        Member  = _context.Members.Find(int.Parse(Request.Form["SpeakerMember"][i])),
                        Topic   = Request.Form["SpeakerTopic"][i],
                        Minutes = int.Parse(Request.Form["SpeakerMinutes"][i]),
                    };
                    _context.Speakers.Add(s);
                }
                await _context.SaveChangesAsync();

                // End add

                return(RedirectToAction(nameof(Index)));
            }
            return(View(meeting));
        }
Beispiel #28
0
        async Task SaveValuesAsync(IDialogContext context, RegisterForm registration)
        {
            MeetingData mtgData = await new MeetingState().GetAsync(context.Activity) ?? new MeetingData();

            using (var ctx = new MeetingContext())
            {
                User user =
                    await
                        (from usr in ctx.Users
                        where usr.UserID == mtgData.UserDBID ||
                        usr.Email == registration.Email
                        select usr)
                    .SingleOrDefaultAsync();

                if (user == null)
                {
                    user = new User
                    {
                        Email = registration.Name,
                        Name  = registration.Email
                    };
                    ctx.Users.Add(user);
                }
                else
                {
                    user.Name  = registration.Name;
                    user.Email = registration.Email;
                }

                await ctx.SaveChangesAsync();
            }

            await context.PostAsync("Registration succeeded!");
        }
Beispiel #29
0
        async Task SaveValuesAsync(IDialogContext context, AppointmentForm appointment)
        {
            MeetingData mtgData = await new MeetingState().GetAsync(context.Activity) ?? new MeetingData();

            using (var ctx = new MeetingContext())
            {
                ctx.Appointments.Add(
                    new Appointment
                {
                    UserID  = mtgData.UserDBID,
                    VenueID =
                        (from venue in venues
                         where venue.Name == appointment.Venue
                         select venue.VenueID)
                        .Single(),
                    Time = new DateTime(
                        appointment.Date.Year, appointment.Date.Month, appointment.Date.Day,
                        appointment.Time.Hour, appointment.Time.Minute, 0)
                });

                await ctx.SaveChangesAsync();
            }

            await context.PostAsync("Venue added!");
        }
        public async Task <ActionResult> Create(Meeting meet)
        {
            meet.Start       = new DateTime(meet.Date.Year, meet.Date.Month, meet.Date.Day, meet.TimeStart.Hours, meet.TimeStart.Minutes, meet.TimeStart.Seconds);
            meet.End         = new DateTime(meet.Date.Year, meet.Date.Month, meet.Date.Day, meet.TimeEnd.Hours, meet.TimeEnd.Minutes, meet.TimeEnd.Seconds);
            meet.ResourceId  = meet.RoomId;
            meet.UserIds     = string.Join(",", meet.SelectedPeople);
            meet.Description = meet.UserIds;
            _db1.Add(meet);
            //foreach (var user in meet.SelectedPeople)
            //{
            //    meet.EventsUsers.Add(new EventsUsers { MeetingId = meet.Id, UserId = user });
            //}

            await _db1.SaveChangesAsync();

            await Message1(meet, Models.Type.MeetCreated);

            return(RedirectToAction("Index"));
        }