Ejemplo n.º 1
0
        public async Task UpdateShipmentByIdAsync(string code, FormShipmentModel model)
        {
            var entity = _shipmentRepository.GetShipment(model.Id.ToString());

            _mapper.Map <FormShipmentModel, Shipment>(model, entity);

            _shipmentRequestRepository.UpdateShipmentRequest(model.RequestIdList, model.Id);
            _uow.GetRepository <IShipmentRepository>().Update(entity);

            await _uow.SaveChangesAsync();
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> CreateShipment(FormShipmentModel model)
        {
            var userIdentity = GetCurrentIdentity <long>();

            model.CoordinatorId = userIdentity.Id;
            var shipmentId = await _Shipmentservice.CreateShipmentAsync(model);

            await _shipmentRequestService.CreateShipmentRequestAsync(model.RequestIdList, shipmentId);

            return(Ok());
        }
Ejemplo n.º 3
0
        public async Task <int> CreateShipmentAsync(FormShipmentModel model)
        {
            var entity = _mapper.Map <Shipment>(model);

            //get Created Date
            entity.CreatedDate = DateTime.Parse(String.Format("{0:G}", DateTime.Now));             // TODO: Use DateTime.Now only

            entity.Code = Helper.GenerateCode(DateTime.Now, entity.CoordinatorId);

            entity.Status = ShipmentStatus.INACTIVE;

            _uow.GetRepository <IShipmentRepository>().Create(entity);

            await _uow.SaveChangesAsync();

            return(entity.Id);
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> UpdateShipment(string id, FormShipmentModel model)
        {
            await _Shipmentservice.UpdateShipmentByIdAsync(id, model);

            return(Ok());
        }