public new bool Add(Cell cell) { var cellAdd = new Cell(); var warehouse = WarehouseRepository.GetQueryable().FirstOrDefault(w => w.WarehouseCode == cell.WarehouseCode); var area = AreaRepository.GetQueryable().FirstOrDefault(a => a.AreaCode == cell.AreaCode); var shelf = ShelfRepository.GetQueryable().FirstOrDefault(s => s.ShelfCode == cell.ShelfCode); var product = ProductRepository.GetQueryable().FirstOrDefault(p => p.ProductCode == cell.DefaultProductCode); cellAdd.CellCode = cell.CellCode; cellAdd.CellName = cell.CellName; cellAdd.ShortName = cell.ShortName; cellAdd.CellType = cell.CellType; cellAdd.Layer = cell.Layer; cellAdd.Col = cell.Col; cellAdd.ImgX = cell.ImgX; cellAdd.ImgY = cell.ImgY; cellAdd.Rfid = cell.Rfid; cellAdd.Warehouse = warehouse; cellAdd.Area = area; cellAdd.Shelf = shelf; cellAdd.Product = product; cellAdd.MaxQuantity = cell.MaxQuantity; cellAdd.IsSingle = cell.IsSingle; cellAdd.Description = cell.Description; cellAdd.IsActive = cell.IsActive; cellAdd.UpdateTime = DateTime.Now; CellRepository.Add(cellAdd); CellRepository.SaveChanges(); return(true); }