Пример #1
0
        public async Task <IActionResult> DeletePointByIdAsync(Guid pointId, CancellationToken ct)
        {
            if (!_accountsService.CanExecuteAdminRequest(User))
            {
                return(Unauthorized());
            }

            if (pointId == Guid.Empty)
            {
                return(BadRequest(new ApiError(Resources.InvalidParameters, Resources.IdFieldRequired)));
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(new ApiError(ModelState)));
            }

            var point = await _pointsService.GetPointByIdAsync(pointId, ct);

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

            await _pointsService.DeletePointByIdAsync(pointId, ct);

            return(Ok());
        }