Exemple #1
0
        public ActionResult UpdateSubject(int id, SubjectDto subjectDto)
        {
            var subjectModelFromRepo = _repository.GetById(id);

            if (subjectModelFromRepo == null)
            {
                return(NotFound());
            }

            _mapper.Map(subjectDto, subjectModelFromRepo);
            subjectModelFromRepo.Id = id;
            _repository.Update(subjectModelFromRepo);

            _repository.SaveChanges();

            return(NoContent());
        }
Exemple #2
0
        public ActionResult UpdateLecturer(int id, LecturerDto lecturerDto)
        {
            var lecturerModelFromRepo = _repository.GetById(id);

            if (lecturerModelFromRepo == null)
            {
                return(NotFound());
            }

            _mapper.Map(lecturerDto, lecturerModelFromRepo);
            lecturerModelFromRepo.Id = id;
            _repository.Update(lecturerModelFromRepo);

            _repository.SaveChanges();

            return(NoContent());
        }
        public ActionResult UpdateRoom(int id, RoomDto roomDto)
        {
            var roomModelFromRepo = _repository.GetById(id);

            if (roomModelFromRepo == null)
            {
                return(NotFound());
            }

            _mapper.Map(roomDto, roomModelFromRepo);
            roomModelFromRepo.Id = id;
            _repository.Update(roomModelFromRepo);

            _repository.SaveChanges();

            return(NoContent());
        }
        public ActionResult UpdateCourse(int id, CourseDto CourseDto)
        {
            var courseModelFromRepo = _repository.GetById(id);

            if (courseModelFromRepo == null)
            {
                return(NotFound());
            }

            _mapper.Map(CourseDto, courseModelFromRepo);
            courseModelFromRepo.Id = id;
            _repository.Update(courseModelFromRepo);

            _repository.SaveChanges();

            return(NoContent());
        }