public IActionResult AddProductCategory(AddNewProductCategoryModel addproductCategorymodel)
 {
     try
     {
         if (ModelState.IsValid)
         {
             ProductCategory productCategoryModel = ProductCategoryHelper.BindProductCategoryModel(addproductCategorymodel);
             long            productCategoryId    = iProductCategory.AddProductCategory(productCategoryModel);
             if (productCategoryId > 0)
             {
                 return(Ok(ResponseHelper.Success(MessageConstants.ProductCategoryAdded)));
             }
             else if (productCategoryId == ReturnCode.AlreadyExist.GetHashCode())
             {
                 return(Ok(ResponseHelper.Error(MessageConstants.TryDifferentName)));
             }
             else
             {
                 return(Ok(ResponseHelper.Error(MessageConstants.ProductCategoryNotAdded)));
             }
         }
         else
         {
             return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData)));
         }
     }
     catch (Exception ex)
     {
         LogHelper.ExceptionLog(ex.Message + "  :::::  " + ex.StackTrace);
         return(Ok(ResponseHelper.Error(ex.Message)));
     }
 }
        /// <summary>
        /// Converts to product category model.
        /// </summary>
        /// <param name="addNewProductCategoryModel">The model.</param>
        /// <returns></returns>
        public static ProductCategory BindProductCategoryModel(AddNewProductCategoryModel addNewProductCategoryModel)
        {
            ProductCategory productCategoryModel = new ProductCategory();

            if (addNewProductCategoryModel != null)
            {
                productCategoryModel.Name      = addNewProductCategoryModel.Name;
                productCategoryModel.CreatedBy = addNewProductCategoryModel.CreatedBy;
                productCategoryModel.CreatedOn = DateTime.Now;
            }
            return(productCategoryModel);
        }