Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.Net.Http;
- using System.Web.Http;
- using RestApiConfiguration.Data;
- using RestApiConfiguration.Data.Repository;
- namespace RestApiConfiguration.Controllers
- {
- public class ConfigurationController : ApiController
- {
- private readonly ServiceCfg _service;
- public ConfigurationController()
- {
- // _cfgFactory = new ConfigFactory();
- _service = new ServiceCfg();
- }
- public IHttpActionResult GetAll()
- {
- var services = _service.Repository.Get();
- return Ok(services);
- }
- public IHttpActionResult Get(string id)
- {
- var config = _service.Repository.Get(id);
- return Ok(config);
- }
- [Route("configuration/cfgcreate}")]
- public IHttpActionResult Post([FromBody] ConfigurationEntity cfgModel)
- {
- var service = _service.Repository.Insert(cfgModel);
- return Created($"http://localhost:6348/api/Configuration/{service.ConfigName}", service.ConfigName);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement