示例#1
0
        public async Task <IActionResult> DeleteDivisionAsync(ClanId clanId, DivisionId divisionId)
        {
            var userId = HttpContext.GetUserId();

            var clan = await _clanService.FindClanAsync(clanId);

            if (clan == null)
            {
                return(this.NotFound("Clan does not exist."));
            }

            var result = await _clanService.DeleteDivisionAsync(clan, userId, divisionId);

            if (result.IsValid)
            {
                return(this.Ok("The division has been removed."));
            }

            result.AddToModelState(ModelState);

            return(this.BadRequest(new ValidationProblemDetails(ModelState)));
        }