Exemplo n.º 1
0
    private void AddEntry(int value)
    {
        CoinsEntry ce = new CoinsEntry {
            value = value
        };

        string path       = Application.dataPath + "/Data/Coins.json";
        string jsonString = File.ReadAllText(path);

        Coins c = JsonUtility.FromJson <Coins>(jsonString);

        c.coins_list.Add(ce);

        string json = JsonUtility.ToJson(c);

        File.WriteAllText(path, json);
    }
Exemplo n.º 2
0
        public async Task <IActionResult> AddCoinsByEmail(CoinsEntry entry)
        {
            try
            {
                User user = await _userManager.CheckEmailForExistance(entry.Email);

                if (user != null)
                {
                    await _adminManager.AddCoinsByEmail(entry.Email, entry.Coins);
                }
                else
                {
                    return(NotFound("Invalid email"));
                }
            }
            catch (Exception ex)
            {
                await _logger.LogCustomExceptionAsync(ex, null);

                return(RedirectToAction("Index", "Home"));
            }
            return(RedirectToAction("Index", "Home"));
        }