コード例 #1
0
        public override Task <CourseDto> UpdateAsync(Guid id, CourseCreateUpdateDto input)
        {
            var course = _repository.FirstOrDefault(x => x.Id == id);

            if (course.UserId == _currentUser.Id)
            {
                return(base.UpdateAsync(id, input));
            }
            return(base.UpdateAsync(new Guid(), input));
        }
コード例 #2
0
        public async override Task <CourseDto> CreateAsync(CourseCreateUpdateDto input)
        {
            input.UserId = (Guid)_currentUser.Id;
            //input.UserId = AbpSession.UserId;
            var x   = base.CreateAsync(input);
            var rs  = await x;
            var per = new CoursesPermissionCreateUpdateDto();

            per.UserId   = input.UserId;
            per.CourseId = rs.Id;
            var ins = ObjectMapper.Map <CoursesPermissionCreateUpdateDto, ParticipationPermission>(per);
            await _parRepo.InsertAsync(ins);

            return(rs);
        }