<commit_before>using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.SwaggerGen.Annotations;
using HETSAPI.Models;
using HETSAPI.ViewModels;
using HETSAPI.Services;
using HETSAPI.Authorization;

namespace HETSAPI.Controllers
{
    /// <summary>
    /// Rental Request Controller
    /// </summary>
    [ResponseCache(Location = ResponseCacheLocation.None, NoStore = true)]
    public class RentalRequestController : Controller
    {
        private readonly IRentalRequestService _service;

        /// <summary>
        /// Rental Request Controller Constructor
        /// </summary>
        public RentalRequestController(IRentalRequestService service)
        {
            _service = service;
        }

        /// <summary>
        /// Create bulk rental request records
        /// </summary>
        /// <param name="items"></param>
        /// <response code="201">RentalRequest created</response>
        [HttpPost]
        [Route("/api/rentalrequests/bulk")]
        [SwaggerOperation("RentalrequestsBulkPost")]
        [RequiresPermission(Permission.ADMIN)]
        public virtual IActionResult RentalrequestsBulkPost([FromBody]RentalRequest[] items)
        {
            return _service.RentalrequestsBulkPostAsync(items);
        }

        /// <summary>
        /// Get all rental requests
        /// </summary>
        /// <response code="200">OK</response>
        [HttpGet]
        [Route("/api/rentalrequests")]
        [SwaggerOperation("RentalrequestsGet")]
        [SwaggerResponse(200, type: typeof(List<RentalRequestViewModel>))]
        public virtual IActionResult RentalrequestsGet()
        {
            return _service.RentalrequestsGetAsync();
        }

        /// <summary>
        /// Delete rental request
        /// </summary>
        /// <param name="id">id of RentalRequest to delete</param>
        /// <response code="200">OK</response>
        /// <response code="404">RentalRequest not found</response>
        [HttpPost]
        [Route("/api/rentalrequests/{id}/delete")]
        [SwaggerOperation("RentalrequestsIdDeletePost")]
        public virtual IActionResult RentalrequestsIdDeletePost([FromRoute]int id)
        {
            return _service.RentalrequestsIdDeletePostAsync(id);
        }

        /// <summary>
        /// Get rental request by id
        /// </summary>
        /// <param name="id">id of RentalRequest to fetch</param>
        /// <response code="200">OK</response>
        /// <response code="404">RentalRequest not found</response>
        [HttpGet]
        [Route("/api/rentalrequests/{id}")]
        [SwaggerOperation("RentalrequestsIdGet")]
        [SwaggerResponse(200, type: typeof(RentalRequestViewModel))]
        public virtual IActionResult RentalrequestsIdGet([FromRoute]int id)
        {
            return _service.RentalrequestsIdGetAsync(id);
        }

        /// <summary>
        /// Update rental request
        /// </summary>
        /// <param name="id">id of RentalRequest to update</param>
        /// <param name="item"></param>
        /// <response code="200">OK</response>
        /// <response code="404">RentalRequest not found</response>
        [HttpPut]
        [Route("/api/rentalrequests/{id}")]
        [SwaggerOperation("RentalrequestsIdPut")]
        [SwaggerResponse(200, type: typeof(RentalRequestViewModel))]
        public virtual IActionResult RentalrequestsIdPut([FromRoute]int id, [FromBody]RentalRequest item)
        {
            return _service.RentalrequestsIdPutAsync(id, item);
        }        

        /// <summary>
        /// Create rental request
        /// </summary>
        /// <param name="item"></param>
        /// <response code="201">RentalRequest created</response>
        [HttpPost]
        [Route("/api/rentalrequests")]
        [SwaggerOperation("RentalrequestsPost")]
        [SwaggerResponse(200, type: typeof(RentalRequestViewModel))]
        public virtual IActionResult RentalrequestsPost([FromBody]RentalRequest item)
        {
            return _service.RentalrequestsPostAsync(item);
        }

        /// <summary>
        /// Move a Rental Request from New (inactive) to In Progress (Active)
        /// </summary>
        /// <param name="id"></param>
        /// <response>RentalRequest</response>
        [HttpGet]
        [Route("/api/rentalrequests/{id}/inProgress")]
        [SwaggerOperation("RentalrequestsPost")]
        [SwaggerResponse(200, type: typeof(RentalRequestViewModel))]
        public virtual IActionResult RentalrequestsInProgressPostAsync([FromRoute]int id)
        {<commit_msg>Added HTTP Error Message to the Swagger API defintion (HTTP405 - cannot create duplicate Rental Request)<commit_after>using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.SwaggerGen.Annotations;
using HETSAPI.Models;
using HETSAPI.ViewModels;
using HETSAPI.Services;
using HETSAPI.Authorization;

namespace HETSAPI.Controllers
{
    /// <summary>
    /// Rental Request Controller
    /// </summary>
    [ResponseCache(Location = ResponseCacheLocation.None, NoStore = true)]
    public class RentalRequestController : Controller
    {
        private readonly IRentalRequestService _service;

        /// <summary>
        /// Rental Request Controller Constructor
        /// </summary>
        public RentalRequestController(IRentalRequestService service)
        {
            _service = service;
        }

        /// <summary>
        /// Create bulk rental request records
        /// </summary>
        /// <param name="items"></param>
        /// <response code="201">RentalRequest created</response>
        [HttpPost]
        [Route("/api/rentalrequests/bulk")]
        [SwaggerOperation("RentalrequestsBulkPost")]
        [RequiresPermission(Permission.ADMIN)]
        public virtual IActionResult RentalrequestsBulkPost([FromBody]RentalRequest[] items)
        {
            return _service.RentalrequestsBulkPostAsync(items);
        }

        /// <summary>
        /// Get all rental requests
        /// </summary>
        /// <response code="200">OK</response>
        [HttpGet]
        [Route("/api/rentalrequests")]
        [SwaggerOperation("RentalrequestsGet")]
        [SwaggerResponse(200, type: typeof(List<RentalRequestViewModel>))]
        public virtual IActionResult RentalrequestsGet()
        {
            return _service.RentalrequestsGetAsync();
        }

        /// <summary>
        /// Delete rental request
        /// </summary>
        /// <param name="id">id of RentalRequest to delete</param>
        /// <response code="200">OK</response>
        /// <response code="404">RentalRequest not found</response>
        [HttpPost]
        [Route("/api/rentalrequests/{id}/delete")]
        [SwaggerOperation("RentalrequestsIdDeletePost")]
        public virtual IActionResult RentalrequestsIdDeletePost([FromRoute]int id)
        {
            return _service.RentalrequestsIdDeletePostAsync(id);
        }

        /// <summary>
        /// Get rental request by id
        /// </summary>
        /// <param name="id">id of RentalRequest to fetch</param>
        /// <response code="200">OK</response>
        /// <response code="404">RentalRequest not found</response>
        [HttpGet]
        [Route("/api/rentalrequests/{id}")]
        [SwaggerOperation("RentalrequestsIdGet")]
        [SwaggerResponse(200, type: typeof(RentalRequestViewModel))]
        public virtual IActionResult RentalrequestsIdGet([FromRoute]int id)
        {
            return _service.RentalrequestsIdGetAsync(id);
        }

        /// <summary>
        /// Update rental request
        /// </summary>
        /// <param name="id">id of RentalRequest to update</param>
        /// <param name="item"></param>
        /// <response code="200">OK</response>
        /// <response code="404">RentalRequest not found</response>
        [HttpPut]
        [Route("/api/rentalrequests/{id}")]
        [SwaggerOperation("RentalrequestsIdPut")]
        [SwaggerResponse(200, type: typeof(RentalRequestViewModel))]
        public virtual IActionResult RentalrequestsIdPut([FromRoute]int id, [FromBody]RentalRequest item)
        {
            return _service.RentalrequestsIdPutAsync(id, item);
        }

        /// <summary>
        /// Create rental request
        /// </summary>
        /// <param name="item"></param>
        /// <response code="201">RentalRequest created</response>
        /// <response code="405">In Progress Rental Request already exists</response>
        [HttpPost]
        [Route("/api/rentalrequests")]
        [SwaggerOperation("RentalrequestsPost")]
        [SwaggerResponse(200, type: typeof(RentalRequestViewModel))]
        public virtual IActionResult RentalrequestsPost([FromBody]RentalRequest item)
        {
            return _service.RentalrequestsPostAsync(item);
        }

        /// <summary>
        /// Move a Rental Request from New (inactive) to In Progress (Active)
        /// </summary>
        /// <param name="id"></param>
        /// <response>RentalRequest</response>
        [HttpGet]
        [Route("/api/rentalrequests/{id}/inProgress")]
        [SwaggerOperation("RentalrequestsPost")]
        [SwaggerResponse(200, type: typeof(RentalRequestViewModel))]
        public virtual IActionResult RentalrequestsInProgressPostAsync([FromRoute]int id)
        {
{'fraction_non_alphanumeric': 0.1287434722370244, 'fraction_numerical': 0.00959181498454652, 'mean_word_length': 2.4235680408609994, 'pattern_counts': {'":': 0, '<': 111, '<?xml version=': 0, '>': 111, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5828472', 'n_tokens_mistral': 2535, 'n_tokens_neox': 2445, 'n_words': 488}