Ejemplo n.º 1
0
        public async Task <IActionResult> GetClubMembers([FromQuery] int clubId)
        {
            var response = new ListModelResponse <ClubMember>()
                           as IListModelResponse <ClubMember>;

            try
            {
                if (clubId < 1)
                {
                    throw new Exception("Club Id is null");
                }
                response.Model = await Task.Run(() =>
                {
                    IEnumerable <ClubMember> member = _context.GetMembers(clubId);
                    if (member == null)
                    {
                        throw new Exception("Club Member does not Exist");
                    }
                    return(member);
                });
            }
            catch (Exception ex)
            {
                response.DidError     = true;
                response.ErrorMessage = ex.Message;
            }
            return(response.ToHttpResponse());
        }
Ejemplo n.º 2
0
 public IActionResult GetClubMembers(int clubId)
 {
     if (ModelState.IsValid)
     {
         return(Json(_memberRepo.GetMembers(clubId)));
     }
     else
     {
         return(BadRequest(ModelState));
     }
 }