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));
        }
        public async Task <IActionResult> Create([Bind("ID,Date,Conducting,OpeningHymn,Invocation,SacramentHymn,SacramentPrayer,ClosingHymn,Benediction,Speakers")] MeetingView meeting)
        {
            if (ModelState.IsValid)
            {
                Meeting newMeeting = new Meeting {
                    Date = meeting.Date, Conducting = meeting.Conducting, OpeningHymn = meeting.OpeningHymn, Invocation = meeting.Invocation, SacramentHymn = meeting.SacramentHymn, SacramentPrayer = meeting.SacramentPrayer, ClosingHymn = meeting.ClosingHymn, Benediction = meeting.Benediction
                };

                _context.Add(newMeeting);
                await _context.SaveChangesAsync();

                var speakers = meeting.Speakers.ToArray();

                foreach (Speaker s in speakers)
                {
                    s.MeetingID = newMeeting.ID;
                    _context.Speakers.Add(s);
                }

                await _context.SaveChangesAsync();

                //foreach(Speaker s in speakers)
                //{
                //    SpeakerEnrollment se = new SpeakerEnrollment {SpeakerID = s.ID, MeetingID = newMeeting.ID };
                //    _context.SpeakerEnrollments.Add(se);
                //}
                //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("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));
        }
예제 #5
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("ID,Name")] Ward ward)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ward);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(ward));
        }
예제 #7
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));
        }
예제 #8
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("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));
        }
예제 #10
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));
        }
예제 #11
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));
        }
        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));
        }
        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));
        }
        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));
        }
예제 #15
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));
        }
예제 #16
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("Id,Title,EventColor")] Room room)
        {
            if (ModelState.IsValid)
            {
                _context.Add(room);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(room));
        }
        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,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("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("ID,MeetingDate,Conductor,OpeningHymn,Invocation,SacramentHymn,ClosingHymn,Benediction,Notes")] Meeting meeting, Speaker speaker)
        {
            if (ModelState.IsValid)
            {
                _context.Add(meeting);

                speaker.Name = Request.Form["Name"];
                _context.AddRange(speaker);

                SpeakingAssignment topic = new SpeakingAssignment();
                topic.Topic     = Request.Form["Topic"];
                topic.MeetingID = meeting.ID;
                topic.SpeakerID = speaker.ID;
                _context.AddRange(topic);

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(meeting));
        }
        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));
        }
        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));
        }
예제 #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));
        }
예제 #25
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));
        }
예제 #26
0
        public void SaveMeeting(MeetingContext context, Meeting input)
        {
            var graph = context.Meetings.AsNoTracking()
                        //            .Include(b => b.Races)
                        .FirstOrDefault(m => m.OuterId == input.OuterId);

            if (graph != null)
            {
                context.Meetings.Remove(graph);
                context.SaveChanges();
            }

            context.Add(input);
        }
예제 #27
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));
        }
        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));
        }
예제 #29
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 <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"));
        }