mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Initial state
This commit is contained in:
30
samples/angular/MusicStore/Apis/ArtistsApiController.cs
Normal file
30
samples/angular/MusicStore/Apis/ArtistsApiController.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using MusicStore.Models;
|
||||
|
||||
namespace MusicStore.Apis
|
||||
{
|
||||
[Route("api/artists")]
|
||||
public class ArtistsApiController : Controller
|
||||
{
|
||||
private readonly MusicStoreContext _storeContext;
|
||||
|
||||
public ArtistsApiController(MusicStoreContext storeContext)
|
||||
{
|
||||
_storeContext = storeContext;
|
||||
}
|
||||
|
||||
[HttpGet("lookup")]
|
||||
public async Task<ActionResult> Lookup()
|
||||
{
|
||||
var artists = await _storeContext.Artists
|
||||
.OrderBy(a => a.Name)
|
||||
.ToListAsync();
|
||||
|
||||
return Json(artists);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user