public ActionResult DeleteSubCategory()
        {
            IEcommerceManagerFacade employeeFacade = (IEcommerceManagerFacade)FacadeFactory.Instance.Create(FacadeType.EcommerceManager);

            OperationResult <bool> result = employeeFacade.deleteSubCategory(deleteSubCategory);
            JsonResult             retVal;

            if (result.IsValid())
            {
                retVal = new JsonResult()
                {
                    Data = "Sucessfully Deleted",
                    JsonRequestBehavior = JsonRequestBehavior.AllowGet
                };
            }
            else
            {
                retVal = new JsonResult()
                {
                    Data = "Not Deleted",
                    JsonRequestBehavior = JsonRequestBehavior.AllowGet
                };
            }
            return(retVal);
        }
示例#2
0
        private static void removeSubCategory()
        {
            int subCategoryId = 6;

            IEcommerceManagerFacade subCategoryManagerFacade = (IEcommerceManagerFacade)FacadeFactory.Instance.Create(FacadeType.EcommerceManager, null);
            OperationResult <bool>  operationResult          = subCategoryManagerFacade.deleteSubCategory(subCategoryId);

            if (operationResult.IsValid())
            {
                System.Console.WriteLine("Deleted");
            }
            else if (operationResult.HasValidationFailed() && operationResult.ValidationResult != null)
            {
                foreach (EmployeePortalValidationFailure error in operationResult.ValidationResult.Errors)
                {
                    System.Console.WriteLine(error.PropertyName + "  " + error.ErrorMessage);
                }
            }
            else if (operationResult.Message != String.Empty && operationResult.StackTrace != String.Empty)
            {
                System.Console.WriteLine(operationResult.Message + "  " + operationResult.StackTrace);
            }
        }