Beispiel #1
0
 public IActionResult Post(UpdateMode.Request request)
 {
     try
     {
         StatusService.UpdateService service = new StatusService.UpdateService();
         // Request验证
         if (request == null)
         {
             throw new Exception("Request无效!");
         }
         // Entity
         if (request.Entity != null)
         {
             request.Entity.EditUserId   = GetUserIdFromClaim();
             request.Entity.EditDateTime = DateTime.Now;
         }
         // Entities
         if (request.Entities != null)
         {
             request.Entities.ForEach(entity =>
             {
                 entity.EditUserId   = GetUserIdFromClaim();
                 entity.EditDateTime = DateTime.Now;
             });
         }
         // 指向具体执行的方法
         switch (request.Function.Name.ToLower())
         {
         default:
             if (string.IsNullOrEmpty(request.Function.Name))
             {
                 if (request.Entity != null)
                 {
                     return(base.ResponseOk(
                                request.ToResponse(
                                    service.Commit(request.Entity)
                                    )
                                ));
                 }
                 else
                 {
                     return(base.ResponseOk(
                                request.ToResponse(
                                    service.Commit(request.Entities)
                                    )
                                ));
                 }
             }
             else
             {
                 throw new Exception("未发现对应函数方法!");
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #2
0
 public IActionResult Post(UpdateMode.Request request)
 {
     try
     {
         UserPowerService.UpdateService service = new UserPowerService.UpdateService();
         // Request验证
         if (request == null)
         {
             throw new Exception("Request无效!");
         }
         // 指向具体执行的方法
         switch (request.Function.Name.ToLower())
         {
         default:
             if (string.IsNullOrEmpty(request.Function.Name))
             {
                 if (request.Entity != null)
                 {
                     return(base.ResponseOk(
                                request.ToResponse(
                                    service.Commit(request.Entity)
                                    )
                                ));
                 }
                 else
                 {
                     return(base.ResponseOk(
                                request.ToResponse(
                                    service.Commit(request.Entities)
                                    )
                                ));
                 }
             }
             else
             {
                 throw new Exception("未发现对应函数方法!");
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #3
0
        public IActionResult Post(UpdateMode.Request request)
        {
            try
            {
                UserService.UpdateService service = new UserService.UpdateService();
                // Request验证
                if (request == null)
                {
                    throw new Exception("Request无效!");
                }
                // Entity
                if (request.Entity != null)
                {
                    request.Entity.EditUserId   = GetUserIdFromClaim();
                    request.Entity.EditDateTime = DateTime.Now;
                }
                // Entities
                if (request.Entities != null)
                {
                    request.Entities.ForEach(entity =>
                    {
                        entity.EditUserId   = GetUserIdFromClaim();
                        entity.EditDateTime = DateTime.Now;
                    });
                }
                // 指向具体执行的方法
                switch (request.Function.Name.ToLower())
                {
                case "toopen":
                    return(base.ResponseOk(
                               request.ToResponse(
                                   service.ToOpen(request.Entity)
                                   )
                               ));

                case "toclose":
                    return(base.ResponseOk(
                               request.ToResponse(
                                   service.ToClose(request.Entity)
                                   )
                               ));

                case "wechatunbind":
                    return(base.ResponseOk(
                               request.ToResponse(
                                   service.WeChatUnbind(request.Entity)
                                   )
                               ));

                default:
                    if (string.IsNullOrEmpty(request.Function.Name) || request.Function.Name.ToLower().Equals("commit"))
                    {
                        if (request.Entity != null)
                        {
                            return(base.ResponseOk(
                                       request.ToResponse(
                                           service.Commit(request.Entity)
                                           )
                                       ));
                        }
                        else
                        {
                            return(base.ResponseOk(
                                       request.ToResponse(
                                           service.Commit(request.Entities)
                                           )
                                       ));
                        }
                    }
                    else
                    {
                        throw new Exception("未发现对应函数方法!");
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }