Exemple #1
0
        public async Task <ActionResult <Position> > DeletePosition(int id)
        {
            var position = _position.GetSingleNoTracking(id);

            if (position == null)
            {
                return(NotFound());
            }
            try
            {
                _position.Delete(position);
                await _position.CommitAsync();
            }
            catch (Exception ex)
            {
                return(BadRequest(new { errors = "Произошла ошибка. " + ex.Message }));
            }
            await _authService.DeleteRole(position.Name);

            return(Content(JsonConvert.SerializeObject(new { message = "Удаление завершено" })));
        }