Exemple #1
0
        public async Task <IActionResult> Create([Bind("ID,FirstName,LastName")] Member member)
        {
            if (ModelState.IsValid)
            {
                _context.Add(member);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(member));
        }
        public async Task <IActionResult> Create([Bind("Id,DateOfMeeting,OpeningPrayer,ConductingLeader,OpeningHymn,SacramentHymn,ClosingHymn,ClosingPrayer")] Message message)
        {
            if (ModelState.IsValid)
            {
                _context.Add(message);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(message));
        }
Exemple #3
0
        public async Task <IActionResult> Create([Bind("Meeting,Conductor,OpeningSong,StartPrayer,SacramentSong,Sacrament,SpeakerOne,SpeakerTwo,OptionalSong,SpeakerThree,ClosingSong,EndPrayer")] PlannedMeeting plannedMeeting)
        {
            if (ModelState.IsValid)
            {
                _context.Add(plannedMeeting);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(plannedMeeting));
        }
Exemple #4
0
        public async Task <IActionResult> Create([Bind("ID,MeetingDate,Conducting,Subjects")] Sacrament sacrament)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sacrament);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(sacrament));
        }
Exemple #5
0
        public async Task <IActionResult> Create([Bind("Id,MeetingDate,ConductingLeader,OpeningSong,SacramentHymn,ClosingSong,IntermediateNumber,OpeningPrayer,ClosingPrayer")] SacramentMeeting sacramentMeeting)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sacramentMeeting);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(sacramentMeeting));
        }
        public async Task <IActionResult> Create([Bind("SpeakersID,Speaker1,Speaker2,Speaker3")] Speakers speakers)
        {
            if (ModelState.IsValid)
            {
                _context.Add(speakers);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(speakers));
        }
        public async Task <IActionResult> Create([Bind("HymnsID,OpeningHymn,OpeningHyNumber,SacramentHymn,SacrHyNumber,ClosingHymn,ClosingNumber")] 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,Name,Value")] Setting setting)
        {
            if (ModelState.IsValid)
            {
                _context.Add(setting);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(setting));
        }
        public async Task <IActionResult> Create([Bind("PrayersID,OpeningPrayers,ClosingPrayers")] Prayers prayers)
        {
            if (ModelState.IsValid)
            {
                _context.Add(prayers);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(prayers));
        }
        public async Task <IActionResult> Create([Bind("ID,MeetingID,SpeakerName,Subject,Block,Order")] Speaker speaker)
        {
            if (ModelState.IsValid)
            {
                _context.Add(speaker);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index), new { meetingId = speaker.MeetingID }));
            }
            ViewData["MeetingID"] = speaker.MeetingID;
            return(View(speaker));
        }
Exemple #11
0
        public async Task <IActionResult> Create([Bind("SpeakerID,MeetingID,SpeakerName,Topic")] Speaker speaker)
        {
            if (ModelState.IsValid)
            {
                _context.Add(speaker);
                await _context.SaveChangesAsync();

                //return back to the details page and show the list of all speakers assigned to this meeeting
                return(RedirectToAction("Details", "Meetings", new { id = speaker.MeetingID }));
            }

            return(RedirectToAction("Details", "Meetings", new { id = speaker.MeetingID }));
        }
Exemple #12
0
        public async Task <IActionResult> Create([Bind("ID,SpeakerID,Topic,SMPID")] Speakers speakers)
        {
            if (ModelState.IsValid)
            {
                _context.Add(speakers);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Create", "Speakers", new { SMPID = speakers.SMPID }));
                //return RedirectToAction(nameof(Index));
            }

            ViewData["SpeakerID"] = new SelectList(_context.Member, "ID", "ID", speakers.SpeakerID);
            ViewData["SMPID"]     = new SelectList(_context.SMP, "ID", "ID", speakers.SMPID);

            return(RedirectToAction("Create", "Speakers", new { SMPID = speakers.SMPID }));
        }
Exemple #13
0
        public async Task <IActionResult> Create([Bind("ID,Name,BishopID,FirstID,SecondID")] Ward ward)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ward);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            var members = _context.Member.Select(s => new
            {
                ID       = s.ID,
                FullName = string.Format("{0} {1}", s.FirstName, s.LastName)
            }).ToList();

            ViewData["BishopID"] = new SelectList(members, "ID", "FullName", ward.BishopID);
            ViewData["FirstID"]  = new SelectList(members, "ID", "FullName", ward.FirstID);
            ViewData["SecondID"] = new SelectList(members, "ID", "FullName", ward.SecondID);
            return(View(ward));
        }
Exemple #14
0
        public async Task <IActionResult> Create([Bind("ID,WardID,PresidingID,ConductingID,Date,OpeningHymnID,SacramentHymnID,IntermediateHymnID,ClosingHymnID,InvocationID,BenedictionID")] SMP sMP)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sMP);
                await _context.SaveChangesAsync();

                //return RedirectToAction(nameof(Index));
            }
            ViewData["BenedictionID"]      = new SelectList(_context.Member, "ID", "ID", sMP.BenedictionID);
            ViewData["ClosingHymnID"]      = new SelectList(_context.Hymn, "ID", "ID", sMP.ClosingHymnID);
            ViewData["ConductingID"]       = new SelectList(_context.Member, "ID", "ID", sMP.ConductingID);
            ViewData["IntermediateHymnID"] = new SelectList(_context.Hymn, "ID", "ID", sMP.IntermediateHymnID);
            ViewData["InvocationID"]       = new SelectList(_context.Member, "ID", "ID", sMP.InvocationID);
            ViewData["OpeningHymnID"]      = new SelectList(_context.Hymn, "ID", "ID", sMP.OpeningHymnID);
            ViewData["PresidingID"]        = new SelectList(_context.Member, "ID", "ID", sMP.PresidingID);
            ViewData["SacramentHymnID"]    = new SelectList(_context.Hymn, "ID", "ID", sMP.SacramentHymnID);
            ViewData["WardID"]             = new SelectList(_context.Ward, "ID", "ID", sMP.WardID);
            return(RedirectToAction("Create", "Speakers", new { SMPID = sMP.ID }));
        }
        public async Task <IActionResult> Create([Bind("Id,MeetingDate,Conducting,Presiding,Invocation,Benediction,OpeningHymn,SacramentHymn,ClosingHymn,Topic")] Meeting meeting)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _context.Add(meeting);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
            }
            catch (DbUpdateException /* ex */)
            {
                //Log the error (uncomment ex variable name and write a log.
                ModelState.AddModelError("", "Unable to save changes. " +
                                         "Try again, and if the problem persists " +
                                         "see your system administrator.");
            }
            return(View(meeting));
        }
Exemple #16
0
        public async Task <IActionResult> Create(
            [Bind("MeetingDate,Conducting,Invocation,OpeningSong,SacramentSong,IntermediateSong,ClosingSong,Benediction")] Meeting meeting)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _context.Add(meeting);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
            } catch (DbUpdateException)
            {
                ModelState.AddModelError("", "Unable to save changes. " +
                                         "Try again, and if the problem persists " +
                                         "see your system administrator.");
            }

            return(View(meeting));
        }