Exemplo n.º 1
0
 public IActionResult Post(SingleMode.Request request)
 {
     try
     {
         DictionaryService.SingleService service = new DictionaryService.SingleService();
         // Request验证
         if (request == null)
         {
             throw new Exception("Request无效!");
         }
         // 指向具体执行的方法
         switch (request.Function.Name.ToLower())
         {
         default:
             if (string.IsNullOrEmpty(request.Function.Name) || request.Function.Name.ToLower().Equals("byid"))
             {
                 return(base.ResponseOk(
                            request.ToResponse(
                                service.ById(ParseInt(request.Function.Args[0] ?? ""), ToParams(request.Function.Args, 1))
                                )
                            ));
             }
             else
             {
                 throw new Exception("未发现对应函数方法!");
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 2
0
 public IActionResult Post(SingleMode.Request request)
 {
     try
     {
         StatusService.SingleService service = new StatusService.SingleService();
         // Request验证
         if (request == null)
         {
             throw new Exception("Request无效!");
         }
         // 指向具体执行的方法
         switch (request.Function.Name.ToLower())
         {
         default:
             if (string.IsNullOrEmpty(request.Function.Name))
             {
                 return(base.ResponseOk(
                            request.ToResponse(
                                service.ById(int.Parse(request.Function.Args[0] ?? ""))
                                )
                            ));
             }
             else
             {
                 throw new Exception("未发现对应函数方法!");
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }