public async Task <bool> UpdateRegistrationType(int registrationId, Registration.RegistrationType type) { var reg = await _db.Registrations .Where(m => m.RegistrationId == registrationId) .FirstOrDefaultAsync(); reg.Type = type; reg.AddLog($"Satte deltakertype til {reg.Type} "); _db.Update(reg); return(await _db.SaveChangesAsync() > 0); }
public static async Task <IDisposableEntity <Registration> > CreateRegistrationAsync( this TestServiceScope scope, EventInfo eventInfo, ApplicationUser user, Registration.RegistrationStatus status = Registration.RegistrationStatus.Verified, Registration.RegistrationType type = Registration.RegistrationType.Participant, Instant?time = null) { var registration = new Registration { EventInfoId = eventInfo.EventInfoId, User = user, Status = status, Type = type, ParticipantName = user.Name, RegistrationTime = time ?? SystemClock.Instance.Now() // TODO: add other params }; await scope.Db.Registrations.AddAsync(registration); await scope.Db.SaveChangesAsync(); return(new DisposableEntity <Registration>(registration, scope.Db)); }