public IActionResult Get(int id)
        {
            WasteManagementEntity wasteManagementEntity = _wasteManagementRepository.GetSingle(u => u.Id == id, u => u.Hubs);

            if (wasteManagementEntity != null)
            {
                WasteManagement wasteManagementDto = Mapper.Map <WasteManagementEntity, WasteManagement>(wasteManagementEntity);
                return(new OkObjectResult(wasteManagementDto));
            }
            else
            {
                return(NotFound());
            }
        }
        public IActionResult Delete(int id)
        {
            WasteManagementEntity wasteManagementEntity = _wasteManagementRepository.GetSingle(id);

            if (wasteManagementEntity == null)
            {
                return(new NotFoundResult());
            }
            else
            {
                _wasteManagementRepository.Delete(wasteManagementEntity);

                _wasteManagementRepository.Commit();

                return(new NoContentResult());
            }
        }
        public IActionResult Create([FromBody] WasteManagementEntity wasteMgmt)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            WasteManagementEntity newWasteManagement = new WasteManagementEntity {
                Name = wasteMgmt.Name
            };

            _wasteManagementRepository.Add(newWasteManagement);
            _wasteManagementRepository.Commit();

            wasteMgmt = Mapper.Map <WasteManagementEntity, WasteManagementEntity>(newWasteManagement);

            CreatedAtRouteResult result = CreatedAtRoute("GetWasteManagement", new { controller = "WasteManagements", id = wasteMgmt.Id }, wasteMgmt);

            return(result);
        }
        public IActionResult Patch(int id, [FromBody] WasteManagement wasteManagement)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            WasteManagementEntity wasteManagementEntity = _wasteManagementRepository.GetSingle(id);

            if (wasteManagementEntity == null)
            {
                return(NotFound());
            }
            else
            {
                wasteManagementEntity.Name = wasteManagement.Name;
                _wasteManagementRepository.Commit();
            }

            var wasteManagementDto = Mapper.Map <WasteManagementEntity, WasteManagement>(wasteManagementEntity);

            return(new OkObjectResult(wasteManagementDto));
        }