예제 #1
0
        public ActionResult SaveCategoryDetails(WebStoreCategoryEditDTO dto)
        {
            if (dto == null || !ModelState.IsValid)
            {
                return(Json(new JsonResponseToken
                {
                    success = false
                    , error = GetModelStateError(ModelState.Values.ToList())
                }));
            }

            string error;

            var result = _webStoreServices.SaveCategory(ref dto, out error);

            if (dto.WebStoreId < 0)
            {
                return(ErrorResponse(error ?? "Something went wrong. Please try again"));
            }

            return(Json(new JsonResponseToken
            {
                success = result
                , result = new
                {
                    id = dto.WebStoreCategoryId
                    , name = dto.CategoryName
                }
                , error = error
            }));
        }