public override Product Update(Product entity) { var entityInDb = RepositoryDbSet .Include(aa => aa.ProductName).ThenInclude(t => t.Translations) .Include(aa => aa.Length).ThenInclude(t => t.Translations) .Include(aa => aa.Weight).ThenInclude(t => t.Translations) .Include(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations) .Include(aa => aa.ShopCode).ThenInclude(t => t.Translations) .FirstOrDefault(x => x.Id == entity.Id); if (entityInDb == null) { return(entity); } entityInDb.Quantity = entity.Quantity; entityInDb.BuyPrice = entity.BuyPrice; entityInDb.PercentageAddedToBuyPrice = entity.PercentageAddedToBuyPrice; entityInDb.SellPrice = entity.SellPrice; entityInDb.ManuFacturerId = entity.ManuFacturerId; entityInDb.InventoryId = entity.InventoryId; entityInDb.ShopId = entity.ShopId; RepositoryDbSet.Update(entityInDb); entityInDb.ProductName.SetTranslation(entity.ProductName); entityInDb.Length.SetTranslation(entity.Length); entityInDb.Weight.SetTranslation(entity.Weight); entityInDb.ManuFacturerItemCode.SetTranslation(entity.ManuFacturerItemCode); entityInDb.ShopCode.SetTranslation(entity.ShopCode); return(entity); }
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)); }
public override Return Update(Return entity) { var entityInDb = RepositoryDbSet .Include(a => a.Description).ThenInclude(t => t.Translations) .FirstOrDefault(x => x.Id == entity.Id); if (entityInDb == null) { return(entity); } entityInDb.ShopId = entity.ShopId; RepositoryDbSet.Update(entityInDb); entityInDb.Description.SetTranslation(entity.Description); return(entity); }
public override Category Update(Category entity) { var entityInDb = RepositoryDbSet .Include(m => m.CategoryName) .ThenInclude(t => t.Translations) .FirstOrDefault(x => x.Id == entity.Id); if (entityInDb == null) { return(entity); } entityInDb.ShopId = entity.ShopId; RepositoryDbSet.Update(entityInDb); entityInDb.CategoryName.SetTranslation(entity.CategoryName); return(entity); }
public override Sale Update(Sale entity) { var entityInDb = RepositoryDbSet .Include(a => a.Description).ThenInclude(t => t.Translations) .FirstOrDefault(x => x.Id == entity.Id); if (entityInDb == null) { return(entity); } entityInDb.AppUserId = entity.AppUserId; entityInDb.SaleInitialCreationTime = entity.SaleInitialCreationTime; RepositoryDbSet.Update(entityInDb); entityInDb.Description.SetTranslation(entity.Description); return(entity); }
public override Inventory Update(Inventory entity) { var entityInDb = RepositoryDbSet .Include(m => m.Description) .ThenInclude(t => t.Translations) .FirstOrDefault(x => x.Id == entity.Id); if (entityInDb == null) { return(entity); } entityInDb.ShopId = entity.ShopId; entityInDb.InventoryCreationTime = entity.InventoryCreationTime; RepositoryDbSet.Update(entityInDb); entityInDb?.Description.SetTranslation(entity.Description); return(entity); }
public override Comment Update(Comment entity) { var entityInDb = RepositoryDbSet .Include(a => a.CommentTitle).ThenInclude(t => t.Translations) .Include(a => a.CommentBody).ThenInclude(t => t.Translations) .FirstOrDefault(x => x.Id == entity.Id); if (entityInDb == null) { return(entity); } entityInDb.ShopId = entity.ShopId; entityInDb.ProductId = entity.ProductId; RepositoryDbSet.Update(entityInDb); entityInDb.CommentTitle.SetTranslation(entity.CommentTitle); entityInDb.CommentBody.SetTranslation(entity.CommentBody); return(entity); }