public IActionResult UpdatePersonalInfo(long id, [FromBody] StudentPersonalInfoDto dto)
        {
            EditPersonalInfoCommand command = new EditPersonalInfoCommand(id, dto.Name, dto.Email);
            Result result = _messages.Dispatch(command);

            return(FromResult(result));
        }
        public IActionResult EditPersonalInfo(Guid id, [FromBody] StudentPersonalInfoDto dto)
        {
            var command = new EditPersonalInfoCommand(id, dto.Name, dto.Email);
            var result  = _messages.Dispatch(command);

            return(FromResult(result));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> EditPersonalInfo(long id, [FromBody] StudentPersonalInfoDto dto)
        {
            var command = new EditPersonalInfoCommand(id, dto.Name, dto.Email);
            var result  = await _dispatcher.Dispatch(command);

            return(FromResult(result));
        }
Exemplo n.º 4
0
        public IActionResult EditPersonalInfo(long id, [FromBody] StudentPersonalInfoDto dto)
        {
            var command = new EditPersonalInfoCommand(id, dto.Name, dto.Email);

            var result = _messages.Dispatch(command);

            return(result.IsSuccess ? Ok() : Error(result.Error));
        }
        public IActionResult EditPersonalInfo(long id, [FromBody] StudentPersonalInfoDto dto)
        {
            var command = new EditPersonalInfoCommand(id, dto.Name, dto.Email);

            //var handler = new EditPersonalInfoCommandHandler(_unitOfWork); //this was before using _messages
            //Result result = handler.Handle(command);

            Result result = _messages.Dispatch(command);

            return(FromResult(result));
        }
Exemplo n.º 6
0
        public IActionResult UpdateInformation([FromBody] StudentPersonalInfoDto studentDto)
        {
            var student = _studentRepository.GetById(studentDto.StudentId);

            if (student == null)
            {
                return(Error($"Student not present"));
            }
            student.FirstMidName = studentDto.FirstName;
            student.LastName     = studentDto.LastName;
            _studentRepository.Update(student);
            return(Ok($" Student personal inforamtion editted successfully from this course. "));
        }
Exemplo n.º 7
0
        public IActionResult EditPersonalInfo([FromBody] StudentPersonalInfoDto studentDto)
        {
            var student = _studentRepository.GetById(studentDto.StudentId);

            if (student == null)
            {
                return(Error($"Student not present"));
            }
            student.FirstMidName = studentDto.FirstName;
            student.LastName     = studentDto.LastName;
            _studentRepository.Update(student);
            return(Ok($" Student information successfully updated "));
        }
        public IActionResult EditPersonalInfo(long id, [FromBody] StudentPersonalInfoDto dto)
        {
            var command = new EditPersonalInfoCommand()
            {
                Email = dto.Email,
                Name  = dto.Name,
                Id    = id
            };

            var handler = new EditPersonalInfoCommandHandler(_unitOfWork);
            var result  = handler.Handle(command);

            return(result.IsSuccess ? Ok() : Error(result.Error));
        }
Exemplo n.º 9
0
        public IActionResult EditPersonalInfo(long id, [FromBody] StudentPersonalInfoDto dto)
        {
            Student student = _studentRepository.GetById(id);

            if (student == null)
            {
                return(Error($"No student found for Id {id}"));
            }

            student.Name  = dto.Name;
            student.Email = dto.Email;

            _unitOfWork.Commit();

            return(Ok());
        }