private void ConvertToJmInventoryTRedeem(JmInventoryTRedeemViewModel vm, JmInventoryTRedeem entity)
        {
            entity.ProgramId = string.IsNullOrEmpty(vm.ProgramId) ? null : _JmInventoryMProgramTasks.One(vm.ProgramId);

            entity.RedeemType       = vm.RedeemType;
            entity.RedeemDate       = vm.RedeemDate;
            entity.RedeemValueTotal = vm.RedeemValueTotal;
            entity.RedeemStatus     = vm.RedeemStatus;
            entity.RedeemDateOut    = vm.RedeemDateOut;
            entity.RedeemDateCair   = vm.RedeemDateCair;
            entity.CustomerId       = vm.CustomerId;
            entity.RedeemDesc       = vm.RedeemDesc;
        }
        public ActionResult JmInventoryTRedeems_Create([DataSourceRequest] DataSourceRequest request, JmInventoryTRedeemViewModel vm)
        {
            if (vm != null && ModelState.IsValid)
            {
                JmInventoryTRedeem entity = new JmInventoryTRedeem();
                entity.SetAssignedIdTo(Guid.NewGuid().ToString());

                ConvertToJmInventoryTRedeem(vm, entity);

                entity.CreatedDate = DateTime.Now;
                entity.CreatedBy   = User.Identity.Name;
                entity.DataStatus  = EnumDataStatus.New.ToString();

                _tasks.Insert(entity);
            }

            return(Json(new[] { vm }.ToDataSourceResult(request, ModelState)));
        }