コード例 #1
0
        public async Task DeleteItem(int id)
        {
            var item = _context.Items.Find(id);

            if (item != null)
            {
                _context.Items.Remove(item);
                await _context.SaveChangesAsync();
            }
            else
            {
                //Todo what happens if the item does not exist?
            }
        }
コード例 #2
0
        public async Task DeleteShop(int id)
        {
            var shop = _context.Shops.Find(id);

            if (shop != null)
            {
                _context.Shops.Remove(shop);
                await _context.SaveChangesAsync();
            }
            else
            {
                //Todo what happens if the item does not exist?
            }
        }
コード例 #3
0
        public async Task PostEmail(EmailBll email)
        {
            //Todo ensure this method runs correctly im not great with async calls
            var efEmail = new Email
            {
                EmailId      = email.EmailId,
                EmailAddress = email.EmailAddress,
            };

            _context.Emails.Add(efEmail);
            await _context.SaveChangesAsync();
        }