コード例 #1
0
 public bool Insert(RentedCar car)
 {
     try
     {
         using (var u = new RentedCarBusiness())
         {
             return(u.Insert(car));
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         return(false);
     }
 }
コード例 #2
0
 public IHttpActionResult Post([FromBody] RentedCar car)
 {
     try
     {
         using (var c = new RentedCarBusiness())
         {
             if (c.Insert(car))
             {
                 return(Ok());
             }
             return(NotFound());
         }
     }
     catch (Exception ex)
     {
         return(BadRequest($"{ex}"));
     }
 }