コード例 #1
0
 public bool DeleteSport(Sport sport)
 {
     if (SportsList().Any(a => a.Name == sport.Name))
     {
         _sportRepository.DeleteSport(sport);
         return(true);
     }
     return(false);
 }
コード例 #2
0
ファイル: SportController.cs プロジェクト: VKRM94/XtrmCoach
        // DELETE: api/Sport/5
        public HttpResponseMessage Delete(int id)
        {
            HttpResponseMessage response;

            if (id <= 0)
            {
                response = Request.CreateResponse(HttpStatusCode.NoContent, "Invalid Id Passed.");
                return(response);
            }

            bool isDeleted = _iSportRepository.DeleteSport(id);

            if (isDeleted)
            {
                response = Request.CreateResponse(HttpStatusCode.OK, "Sport successfully deleted.");
            }
            else
            {
                response = Request.CreateResponse(HttpStatusCode.Conflict, "Invalid Sport Id.");
            }

            return(response);
        }
コード例 #3
0
ファイル: SportAccess.cs プロジェクト: ULU-Devteam/SportUnite
 public void DeleteSport(int id)
 {
     _repository.DeleteSport(id);
 }
コード例 #4
0
        public async Task DeleteSport(int id)
        {
            var sport = await _sportRepository.GetSport(id);

            await _sportRepository.DeleteSport(sport);
        }