public async Task <int> Create(MessageRule model) { var generalRuleId = await _generalRuleRepository.Create(model.GeneralRule); model.GeneralRuleId = generalRuleId; var entity = await _db.MessageRule.AddAsync(model.ToDomainModel()); await _db.SaveChangesAsync(); return(entity.Entity.MessageRuleId); }
public async Task <bool> Update(MessageRule model) { var dto = model.ToDomainModel(); if (model.GeneralRule != null) { await _generalRuleRepository.Update(model.GeneralRule); } _db.MessageRule.Update(dto); await _db.SaveChangesAsync(); return(true); }