コード例 #1
0
        public ActionResult ProductReferenceCategoryCreate(System.Guid?productCategoryBecameId, System.Guid?productCategoryParentId, System.Guid?userId)
        {
            var productContract = new ProductReferenceCategoryContract();

            productContract.ProductCategoryNew = new CrudeProductCategoryContract();
            if (productCategoryBecameId != null)
            {
                productContract.ProductCategoryNew.ProductCategoryBecameId = (System.Guid)productCategoryBecameId;
            }
            if (productCategoryParentId != null)
            {
                productContract.ProductCategoryNew.ProductCategoryParentId = (System.Guid)productCategoryParentId;
            }
            if (userId != null)
            {
                productContract.ProductCategoryNew.UserId = (System.Guid)userId;
            }

            if (userId == null)
            {
                productContract.ProductCategoryNew.UserId = new System.Guid("{FFFFFFFF-5555-5555-5555-FFFFFFFFFFFF}");
            }

            ViewBag.DefaultUserName =
                new CrudeDefaultUserServiceClient().FetchByDefaultUserId(productContract.ProductCategoryNew.UserId).DefaultUserName;

            productContract.ProductCategoryNew.DateTime = DateTime.UtcNow;

            return(View(
                       "~/Views/Templates/ProductReference/ProductReferenceCategory/ProductReferenceCategoryCreate.cshtml",
                       productContract
                       ));
        }
コード例 #2
0
        public ActionResult ProductReferenceCategoryCreate([Bind()] ProductReferenceCategoryContract productContract)
        {
            if (ModelState.IsValid)
            {
                new CrudeProductCategoryServiceClient().Insert(productContract.ProductCategoryNew);

                return(RedirectToAction(
                           "ProductReferenceCategoryEdit",
                           new { productCategoryId = Guid.Empty }
                           ));
            }

            return(View(
                       "~/Views/Templates/ProductReference/ProductReferenceCategory/ProductReferenceCategoryCreate.cshtml",
                       productContract
                       ));
        }