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

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RacersExists(Racers.RacerId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Esempio n. 2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            try
            {
                await _context.SaveChangesAsync();

                // if (Resend)
                {
                    // for now just process on save
                    NotificationService.QueueNotification(_context, Notices);

                    NotificationService.ProcessNotificationQueue(_emailSender, _context);
                }
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!NoticesExists(Notices.NoticeId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Esempio n. 3
0
        public async Task <IActionResult> OnPostRecordCheckinAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            if (Checkin.CheckinId == 0)
            {
                Checkin.CheckInTime = DateTime.Now;
                _context.Checkins.Add(Checkin);
            }
            else
            {
                Checkin.CheckOutTime           = DateTime.Now;
                _context.Attach(Checkin).State = EntityState.Modified;
            }



            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CheckinExists(Checkin.CheckinId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("Error", ex.Message);
                InitializeLookups();
                return(Page());
            }

            Success = true;

            SetMemberCookie(Checkin.MemberId);

            return(Page());
        }