Beispiel #1
0
 public IActionResult GetAll([FromBody] Models.Database.StoredProcedures.SP_Users_GetAll.Inputs filterParams)
 {
     try
     {
         _logger2.LogWarning("Warning! Get all start", filterParams);
         if (!filterParams.IsValid())
         {
             return(StatusCode(400, filterParams.ValidationResults));     //Bad request
         }
         filterParams.Token = User.GetToken();
         var dbResult = _ctx.SP_Users_GetAll(filterParams);
         return(FromDatabase(dbResult));
     }
     catch (Exception e)
     {
         _logger.Add(e, "Error in UsersController.GetAll(filterParams)");
         return(Problem(e.Message, e.StackTrace, 500, "Error in GetAll"));
     }
 }
Beispiel #2
0
        public DBResult SP_Users_GetAll(Models.Database.StoredProcedures.SP_Users_GetAll.Inputs inputs,
                                        ISP <Models.Database.StoredProcedures.SP_Users_GetAll.Inputs> sp = null)
        {
            if (inputs == null)
            {
                throw new ArgumentNullException("Invalid inputs data.");
            }

            if (!inputs.IsValid())
            {
                throw new ArgumentException("Invalid data.");
            }

            if (sp == null)
            {
                sp = new FTSS.DP.DapperORM.StoredProcedure.SP_Users_GetAll(GetConnectionString());
            }
            var rst = sp.Call(inputs);

            return(rst);
        }