Exemplo n.º 1
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var speakerToUpdate = await _context.Speaker.FindAsync(id);

            if (await TryUpdateModelAsync <Speaker>(
                    speakerToUpdate,
                    "speaker",
                    s => s.ID, s => s.MeetingID, s => s.PersonID, s => s.Topic
                    ))
            {
                try
                {
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SpeakerExists(Speaker.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            PopulatePersonDropDownList(_context);
            PopulateMeetingsDropDownList(_context);
            return(RedirectToPage("./Index"));
        }
Exemplo n.º 2
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var emptyMusicnum = new MusicalNum();

            if (await TryUpdateModelAsync <MusicalNum>(
                    emptyMusicnum,
                    "Musicalnum", // Prefix for form value.
                    s => s.ID, s => s.SongID, s => s.Performer))
            {
                _context.MusicalNum.Add(emptyMusicnum);
                await _context.SaveChangesAsync();

                return(RedirectToPage("./Index"));
            }
            // Select DepartmentID if TryUpdateModelAsync fails.

            PopulateSongDropDownList(_context);

            return(Page());
        }
Exemplo n.º 3
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Person).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PersonExists(Person.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 4
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var Musictoupdate = await _context.MusicalNum.FindAsync(id);

            if (await TryUpdateModelAsync <MusicalNum>(
                    Musictoupdate,
                    "Musicalnum", // Prefix for form value.
                    s => s.ID, s => s.SongID, s => s.Performer))
            {
                try
                {
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MusicalNumExists(MusicalNum.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            PopulateSongDropDownList(_context);
            return(RedirectToPage("./Index"));
        }
Exemplo n.º 5
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var emptySpeaker = new Speaker();

            if (await TryUpdateModelAsync <Speaker>(
                    emptySpeaker,
                    "speaker", // Prefix for form value.
                    s => s.ID, s => s.MeetingID, s => s.PersonID, s => s.Topic))
            {
                _context.Speaker.Add(emptySpeaker);
                await _context.SaveChangesAsync();

                return(RedirectToPage("./Index"));
            }

            // Select DepartmentID if TryUpdateModelAsync fails.
            PopulatePersonDropDownList(_context);
            PopulateMeetingsDropDownList(_context);
            return(Page());
        }
Exemplo n.º 6
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            MusicalNum = await _context.MusicalNum.FindAsync(id);

            if (MusicalNum != null)
            {
                _context.MusicalNum.Remove(MusicalNum);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 8
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Speaker = await _context.Speaker.FindAsync(id);

            if (Speaker != null)
            {
                _context.Speaker.Remove(Speaker);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 9
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Person = await _context.Person.FindAsync(id);

            if (Person != null)
            {
                _context.Person.Remove(Person);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 10
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            var emptyMeeting = new Meeting();

            if (await TryUpdateModelAsync <Meeting>(
                    emptyMeeting,
                    "meeting", // Prefix for form value.
                    s => s.ID, s => s.MeetingDate, s => s.ConductingID, s => s.PresidingID, s => s.MusicalNumberID, s => s.AccompanimentID, s => s.LeadingMusicID, s => s.OpeningSongID, s => s.OpeningPrayerID, s => s.SacramentSongID, s => s.IntermediateSongID, s => s.ClosingSongID, s => s.ClosingPrayerIdID, s => s.WardName))
            {
                _context.Meeting.Add(emptyMeeting);
                await _context.SaveChangesAsync();

                return(RedirectToPage("./Index"));
            }

            // Select DepartmentID if TryUpdateModelAsync fails.
            PopulatePersonDropDownList(_context);
            PopulateSongDropDownList(_context);
            PopulateMusicNumDropDownList(_context);
            return(Page());
        }