Пример #1
0
        public ShipmentType UpdateShipmentType(ShipmentType shipmentType) {

            _shipmentTypeRepository.Edit(shipmentType);
            _shipmentTypeRepository.Save();

            return shipmentType;
        }
        internal static ShipmentType ToShipmentType(
            this ShipmentTypeRequestModel requestModel, 
            ShipmentType existingShipmentType) {

            existingShipmentType.Name = requestModel.Name;
            existingShipmentType.Price = requestModel.Price.Value;

            return existingShipmentType;
        }
Пример #3
0
        public OperationResult<ShipmentType> AddShipmentType(ShipmentType shipmentType) {

            // If there is already one which has the same name,
            // return unseccessful result back
            if (_shipmentTypeRepository.GetSingleByName(shipmentType.Name) != null) {

                return new OperationResult<ShipmentType>(false);
            }

            shipmentType.Key = Guid.NewGuid();
            shipmentType.CreatedOn = DateTime.Now;

            _shipmentTypeRepository.Add(shipmentType);
            _shipmentTypeRepository.Save();

            return new OperationResult<ShipmentType>(true) { 
                Entity = shipmentType
            };
        }