public AutoBook Get(string id) { var autoBookId = AutoBookProfile.AutoBookCollectionIdToEntityAutoBookId(id); return(_dbContext.Query <Entities.Tenant.AutoBookApi.AutoBook>() .Where(x => x.AutoBookId == autoBookId).ProjectTo <AutoBook>(_mapper.ConfigurationProvider).FirstOrDefault()); }
public void Delete(string id) { var autoBookId = AutoBookProfile.AutoBookCollectionIdToEntityAutoBookId(id); var entity = _dbContext.Query <Entities.Tenant.AutoBookApi.AutoBook>() .Include(x => x.Task) .FirstOrDefault(x => x.AutoBookId == autoBookId); if (entity != null) { _dbContext.Remove(entity); } }
public void Update(AutoBook autoBook) { var autoBookId = AutoBookProfile.AutoBookCollectionIdToEntityAutoBookId(autoBook.Id); var entity = _dbContext.Query <Entities.Tenant.AutoBookApi.AutoBook>() .Include(x => x.Task) .FirstOrDefault(x => x.AutoBookId == autoBookId); if (entity != null) { _mapper.Map(autoBook, entity); _dbContext.Update(entity, post => post.MapTo(autoBook), _mapper); } }