示例#1
0
        public async Task <IActionResult> GetAll([FromBody] GetMemberParms parms)
        {
            try
            {
                IEnumerable <MemberEntity> members = await _memberRepo.GetAll(parms);

                return(this.Ok(members));
            }
            catch (Exception ex)
            {
                Log.LogError(ex, "MemberViewController threw an exception");
                return(BadRequest());
            }
        }
示例#2
0
        public async Task <IEnumerable <MemberEntity> > GetAll(GetMemberParms parms)
        {
            var parameters = new
            {
                Active = parms.ActiveMembers
            };

            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {
                try
                {
                    IEnumerable <MemberEntity> members = (IEnumerable <MemberEntity>) await connection.QueryAsync <MemberEntity>("dbo.GetMembers", parameters, commandType : CommandType.StoredProcedure);

                    return(members);
                }
                catch (Exception ex)
                {
                    Console.Write(string.Format("Error: {0}", ex.Message));
                    return(null);
                }
            }
        }