Exemplo n.º 1
0
        public async Task <User> UpdateUser(User user)
        {
            using (var _dbContext = new CLContext())
            {
                _dbContext.Entry(user).State = EntityState.Modified;
                await _dbContext.SaveChangesAsync();

                return(user);
            }
        }
Exemplo n.º 2
0
        public async Task <Offer> PlaceOffer(Offer offer)
        {
            using (var _dbContext = new CLContext())
            {
                if (offer.Id > 0)
                {
                    _dbContext.Entry(offer).State = EntityState.Modified;
                }
                else
                {
                    _dbContext.Offers.Add(offer);
                }
                await _dbContext.SaveChangesAsync();

                return(offer);
            }
        }
Exemplo n.º 3
0
        public async Task <Order> PlaceOrder(Order order)
        {
            using (var _dbContext = new CLContext())
            {
                if (order.OrderId > 0)
                {
                    _dbContext.Entry(order).State = EntityState.Modified;
                }
                else
                {
                    order.RequestTime = DateTime.UtcNow;
                    _dbContext.Orders.Add(order);
                }
                await _dbContext.SaveChangesAsync();

                return(order);
            }
        }