public async Task <ActionResult <ActivityDto> > DeleteActivity(Guid id)
        {
            var activity = await _repository.GetActivityAsync(id);

            if (activity == null)
            {
                return(NotFound());
            }
            _repository.DeleteActivity(activity);
            await _repository.SaveChangesAsync();

            return(_mapper.Map <ActivityDto>(activity));
        }
        public async Task <IActionResult> DeleteActivities([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var activities = await _activitiesRepository.GetActivity(id);

            if (activities == null)
            {
                return(NotFound());
            }

            await _activitiesRepository.DeleteActivity(activities);

            await _activitiesRepository.Save();

            return(Ok(activities));
        }
        public async Task <IHttpActionResult> DeleteActivity(ActivityDto activity)
        {
            await _Repo.DeleteActivity(activity);

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #4
0
        public async Task <ActionResult> DeleteActivity([FromRoute] int id)
        {
            await _activitiesRepository.DeleteActivity(id);

            return(NoContent());
        }