Esempio n. 1
0
        public async Task <IActionResult> DeRegisterMember([FromQuery] int athleteId)
        {
            var response = new SingleModelResponse <ClubMember>()
                           as ISingleModelResponse <ClubMember>;

            try
            {
                if (athleteId.ToString() == null)
                {
                    throw new Exception("Model is missing");
                }
                response.Model = await Task.Run(() =>
                {
                    _context.DeRegisterMember(athleteId);
                    ClubMember member = new ClubMember
                    {
                        AthleteId = athleteId
                    };
                    return(member);
                });
            }
            catch (Exception ex)
            {
                response.DidError     = true;
                response.ErrorMessage = ex.Message;
            }
            return(response.ToHttpResponse());
        }
Esempio n. 2
0
 public IActionResult DeRegisterMember(ClubMember club)
 {
     if (ModelState.IsValid)
     {
         _memberRepo.DeRegisterMember(club);
         _memberRepo.SaveMember();
         return(Ok());
     }
     else
     {
         return(BadRequest(ModelState));
     }
 }