| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 | 
							- using Microsoft.AspNetCore.Mvc;
 - using ProRestaurant.Models.Restaurants;
 - using ProRestaurant.Repository.Restaurants;
 - using System.Transactions;
 - 
 - namespace ProRestaurant.Controllers.Restaurants
 - {
 -     [Route("api/[controller]")]
 -     [ApiController]
 -     public class RestaurantUserController : ControllerBase
 -     {
 -         public readonly IRestaurantUserRepository repo;
 - 
 -         public RestaurantUserController(IRestaurantUserRepository _repo)
 -         {
 -             repo = _repo;
 -         }
 - 
 - 
 -         [HttpGet("GetRestaurantUsers/{id}")]
 -         public IActionResult GetRestaurantUsers(int id)
 -         {
 -             return new OkObjectResult(repo.GetUsers(id));
 -         }
 -         
 -         [HttpGet("{id}")]
 -         public IActionResult Get(int id)
 -         {
 -             return new OkObjectResult(repo.GetRestaurantUser(id));
 -         }
 -         
 -         [HttpPost]
 -         public IActionResult Post([FromBody] RestaurantUser value)
 -         {
 -             using (var scope = new TransactionScope())
 -             {
 -                 repo.InsertUser(value);
 -                 scope.Complete();
 -                 return CreatedAtAction(nameof(Get), new { id = value.Id }, value);
 -             }
 -         }
 -         
 -         [HttpPut]
 -         public IActionResult Put([FromBody] RestaurantUser value)
 -         {
 -             if (value != null)
 -             {
 -                 using (var scope = new TransactionScope())
 -                 {
 -                     repo.UpdateUser(value);
 -                     scope.Complete();
 -                     return new OkResult();
 -                 }
 -             }
 -             return new NoContentResult();
 -         }
 -         
 -         [HttpDelete("{id}")]
 -         public IActionResult Delete(int id)
 -         {
 -             repo.RemoveUser(id);
 -             return new OkResult();
 -         }
 -     }
 - }
 
 
  |