public string RemoveShoe(ShoeOrder so) { ShoeOrder exists = _repo.GetShoeOrder(so); if (exists == null) { throw new Exception("Invalid Info Homie"); } _repo.RemoveShoeFromOrder(exists.Id); return("Successfully Booted"); }
public string RemoveShoe(ShoeOrder so, string userId) { ShoeOrder order = _repo.GetShoeOrder(so); if (order == null || order.UserId != userId) { throw new Exception("Invalid Info Homie"); } _repo.RemoveShoeFromOrder(order.Id); return("Successfully Booted"); }
public ActionResult <string> RemoveShoeFromOrder([FromBody] ShoeOrder so, int id) { try { so.OrderId = id; return(Ok(_ss.RemoveShoe(so))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <string> RemoveShoeFromOrder([FromBody] ShoeOrder so, int id) { try { so.OrderId = id; string userId = HttpContext.User.FindFirstValue("Id"); return(Ok(_ss.RemoveShoe(so, userId))); } catch (Exception e) { return(BadRequest(e.Message)); } }
internal ShoeOrder GetShoeOrder(ShoeOrder so) { string sql = "SELECT * FROM shoesorders WHERE orderId = @OrderId AND shoeId = @ShoeId"; return(_db.QueryFirstOrDefault <ShoeOrder>(sql, so)); }