Пример #1
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var meetingToUpdate = await _context.Meeting.FindAsync(id);

            // _context.Attach(Meeting).State = EntityState.Modified;
            if (await TryUpdateModelAsync <Meeting>(
                    meetingToUpdate,
                    "meeting", // Prefix for form value.
                    m => m.Date, m => m.Choirister, m => m.Organist, m => m.Invocation, m => m.Presiding, m => m.BishopricID,
                    m => m.Announcements, m => m.WardBusiness, m => m.StakeBusiness,
                    m => m.OpenHymn, m => m.SacHymn, m => m.IntHymn, m => m.CloseHymn,
                    m => m.TalkName1, m => m.TalkSubj1,
                    m => m.TalkName2, m => m.TalkSubj2,
                    m => m.TalkName3, m => m.TalkSubj3,
                    m => m.TalkName4, m => m.TalkSubj4,
                    m => m.TalkName5, m => m.TalkSubj5,
                    m => m.Benediction))
            {
                await _context.SaveChangesAsync();

                return(RedirectToPage("./Index"));
            }
            //PopulateConductingDropDownList(_context, meetingToUpdate.Conducting);
            return(Page());
        }
Пример #2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BishopricExists(Bishopric.BishopricID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Пример #3
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var meeting = await _context.Meeting
                          .AsNoTracking()
                          .FirstOrDefaultAsync(m => m.MeetingID == id);

            if (meeting == null)
            {
                return(NotFound());
            }

            try
            {
                _context.Meeting.Remove(meeting);
                await _context.SaveChangesAsync();

                return(RedirectToPage("./Index"));
            }
            catch (DbUpdateException /* ex */)
            {
                //Log the error (uncomment ex variable name and write a log.)
                return(RedirectToAction("./Delete",
                                        new { id, saveChangesError = true }));
            }
        }
Пример #4
0
        //[BindProperty]
        //public Meeting Meeting { get; set; }

        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var emptyMeeting = new Meeting();

            if (await TryUpdateModelAsync <Meeting>(
                    emptyMeeting,
                    "meeting", // Prefix for form value.
                    m => m.Date, m => m.Choirister, m => m.Organist, m => m.Invocation, m => m.Presiding, m => m.BishopricID,
                    m => m.Announcements, m => m.WardBusiness, m => m.StakeBusiness,
                    m => m.OpenHymn, m => m.SacHymn, m => m.IntHymn, m => m.CloseHymn,
                    m => m.TalkName1, m => m.TalkSubj1,
                    m => m.TalkName2, m => m.TalkSubj2,
                    m => m.TalkName3, m => m.TalkSubj3,
                    m => m.TalkName4, m => m.TalkSubj4,
                    m => m.TalkName5, m => m.TalkSubj5,
                    m => m.Benediction))
            {
                _context.Meeting.Add(emptyMeeting);
                await _context.SaveChangesAsync();

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

            // Select DepartmentID if TryUpdateModelAsync fails.
            //PopulateConductingDropDownList(_context, emptyMeeting.Conducting);
            //return null;
            return(Page());
        }
Пример #5
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            return(RedirectToPage("./Index"));
        }
Пример #6
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

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