public async Task <ApplicationResponse <CourseDto> > GetByIdAsync(string courseId)
        {
            Guid courseGuid = new Guid();

            if (Guid.TryParse(courseId, out courseGuid))
            {
                Course course = await _courseRepository.GetByIdAsync(courseGuid);

                var appResp = new ApplicationResponse <CourseDto>();

                if (course != null)
                {
                    CourseDto dto = _mapper.Map <CourseDto>(course);
                    appResp.Response = dto;
                    appResp.Message  = "OK";
                    return(appResp);
                }
                else
                {
                    appResp.Message = "Not Found";
                    appResp.AddError($"Course Id '{courseId}' Not Found.");
                    return(appResp);
                }
            }
            else
            {
                var response = new ApplicationResponse <CourseDto>();
                response.Response = new CourseDto();
                response.AddError("Identifier is in a wrong format.");
                return(response);
            }
        }
        public async Task <ApplicationResponse <LecturerDto> > GetByIdAsync(string lecturerId)
        {
            Guid lecturerGuid = new Guid();

            if (Guid.TryParse(lecturerId, out lecturerGuid))
            {
                Lecturer lecturer = await _lecturerRepository.GetByIdAsync(lecturerGuid);

                var appResp = new ApplicationResponse <LecturerDto>();

                if (lecturer != null)
                {
                    LecturerDto dto = _mapper.Map <LecturerDto>(lecturer);
                    appResp.Response = dto;
                    appResp.Message  = "OK";
                    return(appResp);
                }
                else
                {
                    appResp.AddError("Not Found");
                    return(appResp);
                }
            }
            else
            {
                var response = new ApplicationResponse <LecturerDto>();
                response.Response = new LecturerDto();
                response.AddError("Identifier is in a wrong format.");
                return(response);
            }
        }
        public async Task <ApplicationResponse <bool> > CreateAsync(LecturerDto lecturer)
        {
            Lecturer domainObj = _mapper.Map <Lecturer>(lecturer);
            bool     created   = await _lecturerRepository.CreateAsync(domainObj);

            lecturer.Id = domainObj.Id;

            if (created)
            {
                return(new ApplicationResponse <bool> {
                    Message = "OK"
                });
            }
            else
            {
                var response = new ApplicationResponse <bool>();
                response.AddError("Sorry, Something went wrong");
                return(response);
            }
        }
        public async Task <ApplicationResponse <bool> > CreateAsync(CourseDto course)
        {
            Course domainObj = _mapper.Map <Course>(course);
            bool   created   = await _courseRepository.CreateAsync(domainObj);

            course.Id          = domainObj.Id;
            course.Lecturer.Id = domainObj.Lecturer.Id;

            if (created)
            {
                return(new ApplicationResponse <bool> {
                    Message = "OK"
                });
            }
            else
            {
                var response = new ApplicationResponse <bool>();
                response.AddError("Sorry, Something went wrong");
                return(response);
            }
        }