GoodMoodProvider/APIGoodMoodProvider/APIGoodMoodProvider/Controllers/UserController.cs
/// <summary>
/// Delete method for [User]
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Delete method for [User]
Delete method for [ User ]
[HttpDelete]
        [AllowAnonymous]
        [Route("{id}")]
        public async Task<IActionResult> DeleteById(Guid id)
        {
            try
            {
                User user = _context.User.FirstOrDefault(u => u.ID == id);
                if (user == null) { return StatusCode(404); }
                await _unitOfWork.UserRepository.DeleteAsync(id);
                Log.Logger.Information($"Info|{DateTime.Now}|User {user.Login} was deleted from database");
                return Ok();
            }
            catch (Exception ex)
            {
                return BadRequest(ex);
            }
        }
[ HttpDelete ] [ AllowAnonymous ] [ Route ( " " ) ] public async Task < IActionResult > DeleteById ( Guid id ) { try { User user = _context . User . FirstOrDefault ( u => u . ID == id ) ; if ( user == null ) { return StatusCode ( 404 ) ; } await _unitOfWork . UserRepository . DeleteAsync ( id ) ; Log . Logger . Information ( $" Info| { DateTime . Now } |User  { user . Login }  was deleted from database " ) ; return Ok ( ) ; } catch ( Exception ex ) { return BadRequest ( ex ) ; } }
Delete method for [User]
Delete method for [ User ]
None
id
Guid
None