using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using Microsoft.AspNet.Identity; using Weee.DAL; using Weee.Models; using Weee.Service; namespace Weee.Controllers { public class CompanyController:ApiControllerBase { private readonly WeeeCompanyDataService service; public CompanyController(WeeeCompanyDataService s) :base(s) { service = s; } // GET api/ [Route("api/Company/getCertificationCompany")] [HttpGet] public IEnumerable GetCertificationCompany() { return service.GetCertificationCompanyNameIDList(); } [Route("api/Company/GetCertificationCompanyByID/{id}")] [HttpGet] public CertificationCompany GetCertificationCompanyByID(int id) { return service.GetCertificationCompanyById(id); } [Route("api/Company/getSupplier")] [HttpGet] public IEnumerable GetgetSupplier() { //to do: join company's supplier later return service.GetNormalCompanyNameIDEmailList(); } [Route("api/Company/Get")] [HttpGet] public object GetCompanyDetail() { object ret = service.GetCurrentCompany(); return ret; } [Route("api/Company/Save/{id?}")] [HttpPost] [Filter.ApiLog] public void SaveCompanyDetail(NormalCompany ToBeSave) { ToBeSave.ID = service.GetCurrentCompany().ID; service.SaveCompanyDetail(ToBeSave); } } }