public ActionResult Buy(int id) { // Get UserName string buyerName = System.Web.HttpContext.Current.User.Identity.Name; // Get ID from UserName int buyerId = _userService.GetUserByUserName(buyerName).Id; // Save ID in Database _itemService.BuyItem(id, buyerId); // Go Back to product list return(RedirectToAction("Index")); }
public async Task <ActionResult <Boolean> > BuyItem(long id) { var result = await _itemService.BuyItem(id); return(Ok(result)); }