public async Task <ActionResult <DeliveryItem> > PutDeliveryItem(long id, DeliveryItem delivery) { if (id != delivery.DeliveryId) { return(BadRequest()); } _context.Entry(delivery).State = EntityState.Modified; await _context.SaveChangesAsync(); return(await _context.DeliveryItems.FindAsync(id));; }
public async Task <ActionResult <BookItem> > PutBookItem(long id, BookItem book) { if (id != book.BookId) { return(BadRequest()); } _context.Entry(book).State = EntityState.Modified; await _context.SaveChangesAsync(); return(await _context.BookItems.FindAsync(id));; }
public async Task <ActionResult <OrderItem> > PutOrderItem(long id, OrderItem order) { if (id != order.OrderId) { return(BadRequest()); } _context.Entry(order).State = EntityState.Modified; await _context.SaveChangesAsync(); return(await _context.OrderItems.FindAsync(id));; }
public async Task <ActionResult <ReviewItem> > PutReviewItem(long id, ReviewItem review) { if (id != review.ReviewId) { return(BadRequest()); } _context.Entry(review).State = EntityState.Modified; await _context.SaveChangesAsync(); return(await _context.ReviewItems.FindAsync(id));; }
public async Task <ActionResult <CartItem> > PutCartItem(long id, CartItem cart) { if (id != cart.CartId) { return(BadRequest()); } // Validate user var userId = cart.UserId; var userName = cart.UserName; var password = cart.Password; // If validation fails, return bad request if (!CommonOperations.ValidateUser(userId, userName, password)) { return(BadRequest()); } _context.Entry(cart).State = EntityState.Modified; await _context.SaveChangesAsync(); return(await _context.CartItems.FindAsync(id));; }