示例#1
0
 public IHttpActionResult Create([FromBody] CategoryViewModel category)
 {
     try
     {
         if (category != null)
         {
             CategoryDTO _category = new CategoryDTO {
                 Id = category.Id, Name = category.Name, Desc = category.Desc
             };
             auctionService.CreateCategory(_category);
             auctionService.Save();
             return(Ok());
         }
         else
         {
             return(BadRequest());
         }
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.ToString()));
     }
 }