Esempio n. 1
0
        public async Task <string> DeleteRunways(int id)
        {
            var runway = runways.GetRunwayAsync(id).GetAwaiter().GetResult();

            if (runway == null)
            {
                return(null);
            }
            runway.IsDeleted = true;
            await dbContext.SaveChangesAsync();

            return("Пистата, е изтрита успешно.");
        }
Esempio n. 2
0
        public async Task <string> EditRunways(RunwayViewModels newRunway)
        {
            var oldRunway = runways.GetRunwayAsync(newRunway.Id).GetAwaiter().GetResult();

            oldRunway.Name        = newRunway.NameRunway;
            oldRunway.Description = newRunway.Description;
            oldRunway.Difficulty  = newRunway.Difficulty;
            oldRunway.ImagName    = newRunway.ImagName;
            oldRunway.TrackLength = newRunway.TrackLength;
            await dbContext.SaveChangesAsync();

            return("Пистата, е променена успешно.");
        }
Esempio n. 3
0
        public async Task <IActionResult> DetailsRunway(int id, string input = null)
        {
            _logger.LogInformation("view details runway");
            var runwayId = await runway.GetRunwayAsync(id);

            var viewModel = new RunwayViewModels
            {
                Id          = runwayId.Id,
                NameRunway  = runwayId.Name,
                TrackLength = runwayId.TrackLength,
                Difficulty  = runwayId.Difficulty,
                Description = runwayId.Description,
                ImagName    = runwayId.ImagName,
                Text        = input,
            };

            return(this.View(viewModel));
        }
Esempio n. 4
0
        public async Task <IActionResult> EditRunway(int id)
        {
            _logger.LogInformation("admin view edit runway");
            var runway = await runways.GetRunwayAsync(id);

            if (runway == null)
            {
                Response.StatusCode = (int)HttpStatusCode.NotFound;
                return(this.RedirectToAction("NotFound", "Error"));
            }
            var viewModel = new RunwayViewModels
            {
                NameRunway  = runway.Name,
                Difficulty  = runway.Difficulty,
                Description = runway.Description,
                TrackLength = runway.TrackLength,
                ImagName    = runway.ImagName,
            };

            return(this.View(viewModel));
        }