Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

UI as well as API

$
0
0

Hi,

I need to create a method, which now will be a UI. Later i need to expose it as api as well. I am using MVC core as my project.

Here is the code for UI. How i can expose this AddUser as api call.

public class UserController : Controller
{

[HttpPost]
public async Task<IActionResult> AddUser(UserModel _userModel)
{

      //UserManager is a business class

       UserManager _userManager=new UserManager ();

      _userManager.AddNewUser(_userModel);

      return View(_userModel);

}

}


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>