Пример #1
0
        public async Task <IActionResult> PutSession(Guid id, SessionDto sessionDto)
        {
            var session = _mapper.Map <Session>(sessionDto);

            if (id != session.Id)
            {
                return(BadRequest());
            }

            _context.Entry(session).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SessionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #2
0
        public async Task <IActionResult> PutTutorialStep(Guid tutorialTargetId, Guid tutorialStepId,
                                                          TutorialStepDto tutorialStepDto)
        {
            if (tutorialStepId != tutorialStepDto.Id)
            {
                return(BadRequest());
            }

            if (tutorialTargetId != tutorialStepDto.TutorialTargetId)
            {
                return(BadRequest());
            }

            var tutorialStep = _mapper.Map <TutorialStep>(tutorialStepDto);

            _context.Entry(tutorialStep).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TutorialStepExists(tutorialStepId))
                {
                    return(NotFound());
                }

                throw;
            }

            return(NoContent());
        }
Пример #3
0
        public async Task <IActionResult> PutTarget(Guid id, TargetDto targetDto)
        {
            var target = _mapper.Map <Target>(targetDto);

            if (id != target.Id)
            {
                return(BadRequest());
            }

            _context.Entry(target).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TargetExists(id))
                {
                    return(NotFound());
                }

                throw;
            }

            return(NoContent());
        }
Пример #4
0
        public async Task <IActionResult> PutStage(Guid id, StageDto stageDto)
        {
            var stage = _mapper.Map <Stage>(stageDto);

            if (id != stage.Id)
            {
                return(BadRequest());
            }

            _context.Entry(stage).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StageExists(id))
                {
                    return(NotFound());
                }

                throw;
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutDirectorDto(Guid id, DirectorDto directorDto)
        {
            if (id != directorDto.Id)
            {
                return(BadRequest());
            }

            var director = _mapper.Map <Director>(directorDto);

            _context.Entry(director).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DirectorDtoExists(id))
                {
                    return(NotFound());
                }

                throw;
            }

            return(NoContent());
        }