Пример #1
0
        public IActionResult ChangeProductActive(int productTypeId, bool active)
        {
            SellerView seller = loginPersistence.PersistLogin();

            if (seller == null)
            {
                return(Json("Not login"));
            }
            try
            {
                eCommerce.UpdateProductActive(int.Parse(seller.Id), productTypeId, active, 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(""));
        }