Ignore:
Timestamp:
10/22/25 13:20:23 (11 months ago)
Author:
stefansaveski <stefansaveski19@…>
Branches:
master
Children:
fc7b4b4
Parents:
c0a75ab (diff), 9694de9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • iknow-api/Controllers/UsersControllers.cs

    rc0a75ab raed1148  
    1 //using iknow_api.Data;
    2 using iknow_api.Models;
     1using iknow_api.Core.Models;
    32using System.Threading.Tasks;
    43using Microsoft.AspNetCore.Mvc;
    5 
     4using iknow_api.Core.Data;
     5using iknow_api.Repository.Interfaces;
     6using iknow_api.Core.Interfaces;
    67
    78namespace iknow_api.Controllers
     
    1112    public class UsersController : ControllerBase
    1213    {
    13         private readonly AppDbContext _context;
    14         private readonly IConfiguration _configuration;
     14        private readonly IUserService _users;
    1515
    16         public UsersController(AppDbContext context, IConfiguration configuration)
     16        public UsersController(IUserService users)
    1717        {
    18             _context = context;
    19             _configuration = configuration;
     18            _users = users;
    2019        }
    2120
    2221        [HttpPost("add")]
    23         public async Task<IActionResult> Add([FromBody] JsonContent body)
     22        public async Task<IActionResult> Add([FromBody] User user)
    2423        {
    25            
    26             return null;
     24            var created = await _users.AddUserAsync(user);
     25            return Ok(created);
    2726        }
    2827
     28        [HttpGet("id/{id}")]
     29        public async Task<IActionResult> GetById(int id)
     30        {
     31            var user = await _users.GetUserByIdAsync(id);
     32            if (user == null)
     33                return NotFound();
     34            return Ok(user);
     35        }
    2936    }
    3037}
Note: See TracChangeset for help on using the changeset viewer.