using Microsoft.AspNetCore.Mvc; using Oqtane.Repository; using Oqtane.Models; using System.Collections.Generic; namespace Oqtane.Controllers { [Route("{site}/api/[controller]")] public class TenantController : Controller { private readonly ITenantRepository tenants; public TenantController(ITenantRepository Tenants) { tenants = Tenants; } // GET: api/ [HttpGet] public IEnumerable Get() { return tenants.GetTenants(); } // GET api//5 [HttpGet("{id}")] public Tenant Get(int id) { return tenants.GetTenant(id); } // POST api/ [HttpPost] public void Post([FromBody] Tenant site) { if (ModelState.IsValid) tenants.AddTenant(site); } // PUT api//5 [HttpPut("{id}")] public void Put(int id, [FromBody] Tenant site) { if (ModelState.IsValid) tenants.UpdateTenant(site); } // DELETE api//5 [HttpDelete("{id}")] public void Delete(int id) { tenants.DeleteTenant(id); } } }