Пример #1
0
        public IActionResult ChangeStatus(int sellerId, int productTypeId, ProductStatus status)
        {
            if (loginPersistence.PersistLogin() == null)
            {
                return(Json("Not login"));
            }

            try
            {
                eCommerce.UpdateProductStatus(sellerId, productTypeId, status, out ICollection <string> errors);
                if (errors.Any())
                {
                    string errorString = "";
                    foreach (string error in errors)
                    {
                        errorString += error + "\n";
                    }
                    errorString.Remove(errorString.Length - 1);
                    return(Json(errorString));
                }
            }
            catch (Exception e)
            {
                return(Json(e.Message));
            }
            return(Json(""));
        }