Пример #1
0
        public async Task <bool> AddPhoneAsync(PhoneModel newPhone)
        {
            context.Phones.Add(newPhone);

            var saveResult = await context.SaveChangesAsync();

            return(saveResult == 1);
        }
Пример #2
0
        public async Task <bool> CancelPhoneAsync(int id)
        {
            var phone = await context.Phones.FindAsync(id);

            phone.ShoppingCartId = null;

            var saveResult = await context.SaveChangesAsync();

            return(saveResult == 1);
        }
Пример #3
0
        public async Task <bool> OpenOrderAsync(int id)
        {
            var order = await context.Orders.FindAsync(id);

            order.Status = Status.Active;

            var saveResult = await context.SaveChangesAsync();

            return(saveResult == 1);
        }
Пример #4
0
 public async Task SaveAsync()
 {
     await context.SaveChangesAsync();
 }