public bool TryRegistration()

in src/Shared/Infrastructure/Infrastructure.Persistence/Repositories/MedicalRegistrationRepository.cs [55:79]


        public bool TryRegistration(string securityId)
        {
            MedicalRegistration registration = new Table<MedicalRegistration>(session)
                .FirstOrDefault(row => row.HealthSecurityId == securityId)
                .Execute();

            if (registration == null || registration.TakenOn != null)
            {
                return false;
            }

            //return new Table<MedicalRegistrationTake>(session)
            //    .Where(row => row.Code == code)
            //    .Select(row => new MedicalRegistrationTake { TakenOn = DateTime.UtcNow })
            //    .UpdateIf(row => row.TakenOn == null)
            //    .Execute()
            //    .Applied;

            new Table<MedicalRegistrationTake>(session)
                .Where(row => row.HealthSecurityId == securityId)
                .Select(row => new MedicalRegistrationTake { TakenOn = DateTime.UtcNow })
                .Update()
                .Execute();
            return true;
        }