Exemplo n.º 1
0
        public async Task <PlanesModel> CreateRecord(PlanesModel request)
        {
            _appDBContext.Add(request);

            await _appDBContext.SaveChangesAsync();

            return(request);
        }
Exemplo n.º 2
0
        public async Task <PlanesModel> UpdateRecord(PlanesModel request)
        {
            var entity = await _appDBContext.Planes.Where(p => p.Id == request.Id).FirstOrDefaultAsync();

            if (entity != null)
            {
                _appDBContext.Update(entity);
                return(entity);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Update([FromBody] PlanesModel request)
        {
            _logger?.LogDebug("'{0}' has been invoked", nameof(Update));

            try
            {
                var plane = await _dataRepository.UpdateRecord(request);

                _logger?.LogInformation("Record have been updated successfully.");

                return(Ok(plane));
            }
            catch (Exception ex)
            {
                _logger?.LogCritical("There was an error on '{0}' invocation: {1}", nameof(Update), ex);
                return(BadRequest(ex));
            }
        }
Exemplo n.º 4
0
        public async Task <IActionResult> SoftDelete([FromBody] PlanesModel request)
        {
            _logger?.LogDebug("'{0}' has been invoked", nameof(SoftDelete));

            try
            {
                var plane = await _dataRepository.DeleteRecord(request);

                _logger?.LogInformation("Airport succesfully set to inactive.");

                return(Ok(plane));
            }
            catch (Exception ex)
            {
                _logger?.LogCritical("There was an error on '{0}' invocation: {1}", nameof(SoftDelete), ex);
                return(BadRequest(ex));
            }
        }
Exemplo n.º 5
0
        private async void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            var modelFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///PlaneIdentifier.Core/Planes.onnx"));

            planeModel = await PlanesModel.CreateFromStreamAsync(modelFile);
        }