コード例 #1
0
ファイル: OrdersService.cs プロジェクト: markdavich/ShoeShoes
        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");
        }
コード例 #2
0
        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");
        }
コード例 #3
0
 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));
     }
 }
コード例 #4
0
 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));
     }
 }
コード例 #5
0
        internal ShoeOrder GetShoeOrder(ShoeOrder so)
        {
            string sql = "SELECT * FROM shoesorders WHERE orderId = @OrderId AND shoeId = @ShoeId";

            return(_db.QueryFirstOrDefault <ShoeOrder>(sql, so));
        }