コード例 #1
0
 public HttpResponseMessage UpdateSubCategoryOfMainCategory([FromBody] MainAndSubRelationshipDTO req)
 {
     try
     {
         bool success;
         if (req.main_id == null || req.sub_id == null || req.sub_name == null || req.google_value == null)
         {
             return(Request.CreateResponse(HttpStatusCode.BadRequest, "missing parameters"));
         }
         success  = SubCategoryService.updateSubCategory(req.sub_id, req.google_value, req.sub_name);
         success &= CategoryService.UpdateDescription(req.main_id, req.sub_id, req.descrition);
         if (success)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, true));
         }
         return(Request.CreateResponse(HttpStatusCode.BadRequest, "Bad request"));
     }
     catch (Exception e)
     {
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, "There was an InternalServerError: " + e));
     }
 }