Ejemplo n.º 1
0
        public ModifyPosDeviceResponse ModifyPosDevice(ModifyPosDeviceRequest request)
        {
            ModifyPosDeviceResponse response = new ModifyPosDeviceResponse();

            PosDevice posDevice = _posDeviceRepository
                                  .FindBy(request.DeviceId);

            posDevice.Id           = request.DeviceId;
            posDevice.BrandId      = request.BrandId;
            posDevice.SerialNumber = request.SerialNumber;
            posDevice.Model        = request.Model;
            posDevice.PosTerminals = request.PosTerminals.ConvertToPosTerminals();


            if (posDevice.GetBrokenRules().Count() > 0)
            {
                response.Errors = posDevice.GetBrokenRules().ToList();
            }
            else
            {
                try {
                    _posDeviceRepository.Save(posDevice);
                    _uow.Commit();
                    response.Errors = new List <BusinessRule>();
                } catch (Exception ex)
                {
                    response.Errors = new List <BusinessRule>();
                    response.Errors.Add(new BusinessRule("DAL", "DAL_ERROR: " + ex.Message));
                }
            }


            return(response);
        }
Ejemplo n.º 2
0
        public JsonResult Update(PosDeviceDetailView vm)
        {
            GetPosDeviceRequest request = new GetPosDeviceRequest();

            request.DeviceId = vm.DeviceId;

            ModifyPosDeviceRequest updateRequest = _posDeviceService.GetPosDevice(request).PosDevice.ConvertToModifyPosDeviceRequest();

            updateRequest.DeviceId     = vm.DeviceId;
            updateRequest.BrandId      = vm.BrandId;
            updateRequest.SerialNumber = vm.SerialNumber;
            updateRequest.Model        = vm.Model;

            ModifyPosDeviceResponse response = _posDeviceService.ModifyPosDevice(updateRequest);

            return(Json(response));
        }