Skip to content
Snippets Groups Projects
Select Git revision
  • master
1 result

45.nfa

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    LicenseController.cs 954 B
    using Coscine.Api.Project.Models;
    using Coscine.Api.Project.ReturnObjects;
    using Coscine.ApiCommons;
    using Microsoft.AspNetCore.Mvc;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace Coscine.Api.Project.Controllers
    {
        public class LicenseController : Controller
        {
            private readonly Authenticator _authenticator;
            private readonly LicenseModel _licenseModel;
    
            public LicenseController()
            {
                _authenticator = new Authenticator(this, Program.Configuration);
                _licenseModel = new LicenseModel();
            }
    
            [Route("[controller]")]
            public IActionResult Index()
            {
                return Ok(_authenticator.ValidateAndExecute((user) =>
                {
                    return _licenseModel.GetAll().Select((license) => new LicenseObject(license.Id, license.DisplayName));
                }));
            }
        }
    }