Esempio n. 1
0
        public async Task <Registrant> UpdateRegistrant(Registrant registrant)
        {
            var originalRegistrant = _context.Registrant.FirstOrDefaultAsync(r => r.Id == registrant.Id);

            if (originalRegistrant == null)
            {
                return(new Registrant());
            }
            var phoneList =
                ModifyPhone(registrant.RegistrantPhone.ToList(), originalRegistrant.Result.RegistrantPhone.ToList());
            var emailList =
                ModifyEmail(registrant.RegistrantEmail.ToList(), originalRegistrant.Result.RegistrantEmail.ToList());

            originalRegistrant.Result.RegistrantPhone = phoneList;
            originalRegistrant.Result.RegistrantEmail = emailList;
            originalRegistrant.Result.Selected        = registrant.Selected;
            originalRegistrant.Result.SportTypeId     = registrant.SportTypeId;
            originalRegistrant.Result.Size            = registrant.Size;
            originalRegistrant.Result.TeamId          = registrant.TeamId;


            await _context.SaveChangesAsync();

            return(originalRegistrant.Result);
        }
Esempio n. 2
0
        public async void CancelEvent(long calendarId, string reason, string note)
        {
            var calendar = await _context.CalendarItems.Where(c => c.Id == calendarId).FirstOrDefaultAsync();

            calendar.CancelReason = reason;
            calendar.Comments     = note;
            await _context.SaveChangesAsync();
        }