Beispiel #1
0
        public async Task <int> Create(DateTimeRule model)
        {
            var generalRuleId = await _generalRuleRepository.Create(model.GeneralRule);

            model.GeneralRuleId = generalRuleId;

            var entity = await _db.DateTimeRule.AddAsync(model.ToDomainModel());

            await _db.SaveChangesAsync();

            return(entity.Entity.DateTimeRuleId);
        }
Beispiel #2
0
        public async Task <bool> Update(DateTimeRule model)
        {
            var dto = model.ToDomainModel();

            if (model.GeneralRule != null)
            {
                await _generalRuleRepository.Update(model.GeneralRule);
            }

            _db.DateTimeRule.Update(dto);
            await _db.SaveChangesAsync();

            return(true);
        }