SHARE
TWEET

Untitled

a guest Jun 15th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public abstract class BaseController : ControllerBase
  2. {
  3.     public int LoggedInUserId
  4.     {
  5.         get
  6.         {
  7.            Task<int> task = Task.Run(async () => await GetLoggedInUserId());
  8.            return task.Result;
  9.         }
  10.     }
  11. }
  12.      
  13. [Route("api/[controller]")]
  14. [ApiController]
  15. public class UsersController : BaseController
  16. {
  17.     public UsersController()
  18.     {
  19.  
  20.     }
  21.  
  22.     [HttpPost("create")]
  23.     public async Task<ActionResult<User>> Create([FromBody] userCreate)
  24.     {
  25.         _userService.CreateUser(userCreate, LoggedInUserId);
  26.     }
  27. }
  28.      
  29. _userService.CreateUser(userCreate, await GetLoggedInUserId());
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top