Beispiel #1
0
        public async Task UpdateAsync(int id, CheckUpdateModel entity)
        {
            var alien = await _alienRepository.GetByIdAsync(entity.AlienID);

            var estabelecimento = await _estabelecimentoRepository.GetByIdAsync(entity.EstabalecimentoId);

            var check   = new Check(DateTime.Now, alien, estabelecimento);
            var checkDb = await _checkRepository.GetCheckByUserId(entity.AlienID);

            if ((DateTime.Now.Minute - check.CheckIn.Minute) < 1)
            {
                throw new Exception("Tempo de checkIn menor que 1 minuto.");;
            }
            check.Update(DateTime.Now);
            await _checkRepository.UpdateAsync(check);
        }
        public async Task <Check> UpdateAsync(Check updateData)
        {
            if (updateData == null)
            {
                throw new ArgumentNullException(nameof(Member));
            }

            var oldData = await _checkRepository.GetByIdAsync(updateData.Id);

            if (oldData == null)
            {
                throw new InvalidOperationException($"Event with the id: {updateData.Id} was not found");
            }

            await _checkRepository.UpdateAsync(updateData);

            return(oldData);
        }