private void ConvertToJmInventoryMProduct(JmInventoryMProductViewModel vm, JmInventoryMProduct entity)
        {
            entity.ProductName   = vm.ProductName;
            entity.ProductType   = vm.ProductType;
            entity.ProductMerk   = vm.ProductMerk;
            entity.ProductStatus = vm.ProductStatus;
            entity.ProductDesc   = vm.ProductDesc;
            entity.ProductImgUrl = vm.ProductImgUrl;

            entity.ProductImg = UploadFiles(UploadFolder.Product, vm.ProductImgUrl);
        }
        public ActionResult JmInventoryMProducts_Create([DataSourceRequest] DataSourceRequest request, JmInventoryMProductViewModel vm)
        {
            if (vm != null && ModelState.IsValid)
            {
                JmInventoryMProduct entity = new JmInventoryMProduct();
                entity.SetAssignedIdTo(vm.ProductId);

                ConvertToJmInventoryMProduct(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)));
        }
 public ActionResult JmInventoryMProducts_Destroy([DataSourceRequest] DataSourceRequest request, JmInventoryMProductViewModel vm)
 {
     if (vm != null)
     {
         var entity = _tasks.One(vm.ProductId);
         if (entity != null)
         {
             entity.ModifiedDate = DateTime.Now;
             entity.ModifiedBy   = User.Identity.Name;
             entity.DataStatus   = EnumDataStatus.Deleted.ToString();
             _tasks.Update(entity);
         }
     }
     return(Json(ModelState.ToDataSourceResult()));
 }