Пример #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"));
        }
Пример #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"));
        }
Пример #3
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            return(RedirectToPage("./Index"));
        }
Пример #4
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());
        }
Пример #5
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

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

            NewNotice.NoticeStatusId = (int)NoticeStatusEnum.New;
            NewNotice.DateCreated    = DateTime.Now;
            NewNotice.DateToSend     = DateTime.Now;


            _context.Notices.Add(NewNotice);
            await _context.SaveChangesAsync();

            // for now just process on save
            NotificationService.QueueNotification(_context, NewNotice);

            NotificationService.ProcessNotificationQueue(_emailSender, _context);



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