public override async Task <Event> AddAsync(Event entity) { //EntityCreationCache var res = (await RepositoryDbSet.AddAsync(EventMapper.MapFromDAL(entity))).Entity; EntityCreationCache.Add(res.Id, res); return(EventMapper.MapFromDomain(res)); }
public override Event Update(Event entity) { var dbUnit = RepositoryDbContext.AdministrativeUnitInEvents.Where(item => item.EventId == entity.Id).ToList(); RepositoryDbContext.RemoveRange(dbUnit); var dbType = RepositoryDbContext.EventInTypes.Where(item => item.EventId == entity.Id).ToList(); RepositoryDbContext.RemoveRange(dbType); return(EventMapper.MapFromDomain(RepositoryDbSet.Update(EventMapper.MapFromDAL(entity)).Entity)); }