Esempio n. 1
0
        public async Task <bool> Update(int id, HandicapsDto data)
        {
            var  handicaps = _mapper.Map <HandicapsDto, Handicaps>(data);
            bool result    = _repo.HandicapsRepository.Update(id, handicaps);
            await _repo.SaveAsync();

            return(result);
        }
Esempio n. 2
0
        public async Task <bool> Insert(HandicapsDto data)
        {
            var  handicaps = _mapper.Map <HandicapsDto, Handicaps>(data);
            bool result    = _repo.HandicapsRepository.Insert(handicaps);
            await _repo.SaveAsync();

            return(result);
        }
Esempio n. 3
0
        public async Task <IActionResult> Post([FromBody] HandicapsDto data)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var result = await _handicapService.Insert(data);

            if (result == true)
            {
                return(Ok());
            }
            return(BadRequest());
        }
Esempio n. 4
0
        public async Task <IActionResult> Put([FromRoute] int id, [FromBody] HandicapsDto data)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            if (id != data.Id)
            {
                return(BadRequest());
            }
            var result = await _handicapService.Update(id, data);

            if (result == true)
            {
                return(Ok());
            }
            return(BadRequest());
        }