| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 | 
							- using Microsoft.AspNetCore.Mvc;
 - using System.Transactions;
 - using UnivateProperties_API.Model.Timeshare;
 - using UnivateProperties_API.Repository;
 - using UnivateProperties_API.Repository.Timeshare;
 - 
 - namespace UnivateProperties_API.Controllers.Timeshare
 - {
 -     [Route("api/[controller]")]
 -     [ApiController]
 -     public class UnitConfigurationController : ControllerBase
 -     {
 -         private readonly IRepository<UnitConfiguration> _Repo;
 - 
 -         public UnitConfigurationController(IRepository<UnitConfiguration> repo)
 -         {
 -             _Repo = repo;
 -         }
 - 
 -         [HttpGet]
 -         public IActionResult Get()
 -         {
 -             var items = (_Repo as UnitConfigurationRepository).GetMyDetailed();
 -             return new OkObjectResult(items);
 -         }
 - 
 -         [HttpGet("{id}")]
 -         public IActionResult Get(int id)
 -         {
 -             var item = _Repo.Get(x => x.Id == id);
 -             return new OkObjectResult(item);
 -         }
 - 
 -         [HttpPost]
 -         public IActionResult Post([FromBody] UnitConfiguration item)
 -         {
 -             using (var scope = new TransactionScope())
 -             {
 -                 _Repo.Insert(item);
 -                 scope.Complete();
 -                 return CreatedAtAction(nameof(Get), new { id = item.Id }, item);
 -             }
 -         }
 - 
 -         [HttpPut("{id}")]
 -         public IActionResult Put([FromBody] UnitConfiguration item)
 -         {
 -             if (item != null)
 -             {
 -                 using (var scope = new TransactionScope())
 -                 {
 -                     _Repo.Update(item);
 -                     scope.Complete();
 -                     return new OkResult();
 -                 }
 -             }
 -             return new NoContentResult();
 -         }
 - 
 -         [HttpDelete("{id}")]
 -         public IActionResult Delete(int id)
 -         {
 -             _Repo.RemoveAtId(id);
 -             return new OkResult();
 -         }
 -     }
 - }
 
 
  |