Пример #1
0
        public AppResult ManageParcelLocation(eCommShipmentLocation shipmentsLocations)
        {
            AppResult result = new AppResult();

            result = new eCommerceAppRepository().ManageParcelLocation(shipmentsLocations);
            return(result);
        }
Пример #2
0
        public AppResult ManageParcelLocation(eCommShipmentLocation shipmentsLocations)
        {
            AppResult result = new AppResult();

            try
            {
                if (shipmentsLocations.UserId > 0 && !string.IsNullOrEmpty(shipmentsLocations.LocationBarcode) && shipmentsLocations.ShipmentBarcodes != null && shipmentsLocations.ShipmentBarcodes.Count > 0)
                {
                    foreach (var data in shipmentsLocations.ShipmentBarcodes)
                    {
                        var query1 = dbContext.eCommerceShipments.Where(p => p.BarCodeNumber == data).FirstOrDefault();
                        var query2 = dbContext.Locations.Where(p => p.Barcode == shipmentsLocations.LocationBarcode).FirstOrDefault();
                        if (query1 != null && query2 != null)
                        {
                            query1.WarehouseLocationId = query2.LocationId;
                            dbContext.SaveChanges();
                            result.Status = true;
                        }
                        else
                        {
                            result.Status = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                result.Status = false;
            }

            return(result);
        }