コード例 #1
0
 public ActionResult Create_new_order(Order to_add)
 {
     if (ModelState.IsValid)
     {
         int res = logic_operations.Create_new_order(to_add);
         if (res == 201)
         {
             return(Ok(new { status = res, message = status_list[res] }));
         }
         return(BadRequest(new { status = res, message = status_list[res] }));
     }
     return(BadRequest(new { status = 402, message = "message: Bad Order data." }));
 }
コード例 #2
0
 public ActionResult Create_new_order(Order to_add)
 {
     if (ModelState.IsValid)
     {
         int    res     = logic_operations.Create_new_order(to_add);
         string message = $"status: {res} " +
                          $"message: {status_list[res]}";
         if (res == 201)
         {
             return(Ok(message));
         }
         return(BadRequest(message));
     }
     return(BadRequest("Bad Order data."));
 }