コード例 #1
0
 public void Save(TypeCoin Typecoin)
 {
     using (var context = _IFactoryContext.Create()) {
         string sqlquery = "insert into TypeCoins(Name,Tag) values(@Name,@Tag)";
         context.Database.ExecuteSqlCommand(sqlquery
                                            , new SqlParameter("Name", Typecoin.Name)
                                            , new SqlParameter("Tag", Typecoin.Tag));
         context.SaveChanges();
     }
 }
コード例 #2
0
        public ActionResult Create(int?id)
        {
            Stream req = Request.InputStream;

            req.Seek(0, System.IO.SeekOrigin.Begin);
            string   json      = new StreamReader(req).ReadToEnd();
            TypeCoin typecoint = JsonConvert.DeserializeObject <TypeCoin>(json);

            _ITypeCoinServices.Save(typecoint);
            return(Json("OK"));
        }
コード例 #3
0
        public async Task RemoveCoinAsync(Guid userId, TypeCoin typeCoin)
        {
            var purse = await FirstOrDefaultAsync(x => x.ApplicationUserId == userId,
                                                  include : sourse => sourse.Include(m => m.PurseCoins));

            PurseCoin findCoins = purse.PurseCoins.FirstOrDefault(x => x.TypeCoin == typeCoin);

            if (findCoins == null || findCoins.Count == 0)
            {
                throw new ApplicationException("This coin is not found");
            }

            findCoins.Count--;
            await Update(purse);
        }
コード例 #4
0
 public Coin(TypeCoin typeCoin)
 {
     TypeCoin = typeCoin;
 }
コード例 #5
0
 public async Task AddCoinAsync(Guid userId, TypeCoin typeCoin)
 {
     await AddCoinsAsync(userId, new List <Coin> {
         new Coin(typeCoin)
     });
 }
コード例 #6
0
 public void Save(TypeCoin Typecoin)
 {
     _ITypeCoinRepository.Save(Typecoin);
 }
        public async Task AddCoinAsync(TypeCoin typeCoin)
        {
            var vmUser = await _userManager.FindByNameAsync(VMUSERNAME);

            await _purseRepository.AddCoinAsync(vmUser.Id, typeCoin);
        }
コード例 #8
0
        public async Task AddCoinAsync(TypeCoin typeCoin)
        {
            var vmUser = await _context.Users.FirstOrDefaultAsync(x => x.UserName == VMUSERNAME);

            await _purseRepository.AddCoinAsync(vmUser.Id, typeCoin);
        }