public async Task <IActionResult> GetPickupPoint(int id)
        {
            PickupPoint record = await repo.GetById(id);

            if (record == null)
            {
                LoggerExtensions.LogException(id, logger, ControllerContext, null, null);
                return(StatusCode(404, new {
                    response = ApiMessages.RecordNotFound()
                }));
            }
            return(StatusCode(200, record));
        }
        public async Task <IActionResult> PatchPickupPoint(int pickupPointId, [FromQuery(Name = "coordinates")] string coordinates)
        {
            PickupPoint record = await repo.GetById(pickupPointId);

            try {
                repo.UpdateCoordinates(pickupPointId, coordinates);
                return(StatusCode(200, new { response = ApiMessages.RecordUpdated() }));
            } catch (DbUpdateException exception) {
                LoggerExtensions.LogException(pickupPointId, logger, ControllerContext, null, exception);
                return(StatusCode(490, new {
                    response = ApiMessages.RecordNotSaved()
                }));
            }
        }
 public IActionResult PutPickupPoint([FromRoute] int id, [FromBody] PickupPoint record)
 {
     if (id == record.Id && ModelState.IsValid)
     {
         try {
             repo.Update(record);
             return(StatusCode(200, new {
                 response = ApiMessages.RecordUpdated()
             }));
         } catch (DbUpdateException exception) {
             LoggerExtensions.LogException(0, logger, ControllerContext, record, exception);
             return(StatusCode(490, new {
                 response = ApiMessages.RecordNotSaved()
             }));
         }
     }
     LoggerExtensions.LogException(0, logger, ControllerContext, record, null);
     return(StatusCode(400, new {
         response = ApiMessages.InvalidModel()
     }));
 }
        public async Task <IActionResult> DeletePickupPoint([FromRoute] int id)
        {
            PickupPoint record = await repo.GetById(id);

            if (record == null)
            {
                LoggerExtensions.LogException(id, logger, ControllerContext, null, null);
                return(StatusCode(404, new {
                    response = ApiMessages.RecordNotFound()
                }));
            }
            try {
                repo.Delete(record);
                return(StatusCode(200, new {
                    response = ApiMessages.RecordDeleted()
                }));
            } catch (DbUpdateException exception) {
                LoggerExtensions.LogException(0, logger, ControllerContext, record, exception);
                return(StatusCode(491, new {
                    response = ApiMessages.RecordInUse()
                }));
            }
        }