コード例 #1
0
        /// <summary>
        /// Delete Course Comment Category
        /// </summary>
        /// <param name="courseCommentCategoryAddViewModel"></param>
        /// <returns></returns>
            public CourseCommentCategoryDeleteViewModel DeleteCourseCommentCategory(CourseCommentCategoryDeleteViewModel courseCommentCategoryDeleteViewModel)
        {
            try
            {
                if (courseCommentCategoryDeleteViewModel.CourseCommentId != null)
                {
                    var courseCommentData = this.context?.CourseCommentCategory.Where(x => x.TenantId == courseCommentCategoryDeleteViewModel.TenantId && x.SchoolId == courseCommentCategoryDeleteViewModel.SchoolId && x.CourseId == courseCommentCategoryDeleteViewModel.CourseId && x.CourseCommentId == courseCommentCategoryDeleteViewModel.CourseCommentId).FirstOrDefault();

                    if (courseCommentData != null)
                    {
                        this.context?.CourseCommentCategory.Remove(courseCommentData);
                    }
                }
                else
                {
                    var courseComments = this.context?.CourseCommentCategory.Where(x => x.TenantId == courseCommentCategoryDeleteViewModel.TenantId && x.SchoolId == courseCommentCategoryDeleteViewModel.SchoolId && x.CourseId == courseCommentCategoryDeleteViewModel.CourseId).ToList();

                    if (courseComments.Count > 0)
                    {
                        this.context?.CourseCommentCategory.RemoveRange(courseComments);
                    }
                }
                this.context?.SaveChanges();
                courseCommentCategoryDeleteViewModel._failure = false;
                courseCommentCategoryDeleteViewModel._message = "Course Comments Deleted Successfully";
            }
            catch (Exception es)
            {
                courseCommentCategoryDeleteViewModel._failure = true;
                courseCommentCategoryDeleteViewModel._message = es.Message;
            }
            return courseCommentCategoryDeleteViewModel;
        }
コード例 #2
0
        public ActionResult <CourseCommentCategoryDeleteViewModel> DeleteCourseCommentCategory(CourseCommentCategoryDeleteViewModel courseCommentCategoryDeleteViewModel)
        {
            CourseCommentCategoryDeleteViewModel courseCommentDelete = new CourseCommentCategoryDeleteViewModel();

            try
            {
                courseCommentDelete = _reportCardService.DeleteCourseCommentCategory(courseCommentCategoryDeleteViewModel);
            }
            catch (Exception ex)
            {
                courseCommentDelete._message = ex.Message;
                courseCommentDelete._failure = true;
            }
            return(courseCommentDelete);
        }
コード例 #3
0
        /// <summary>
        /// Delete Course Comment Category
        /// </summary>
        /// <param name="courseCommentCategoryAddViewModel"></param>
        /// <returns></returns>
        public CourseCommentCategoryDeleteViewModel DeleteCourseCommentCategory(CourseCommentCategoryDeleteViewModel courseCommentCategoryDeleteViewModel)
        {
            CourseCommentCategoryDeleteViewModel courseCommentcategoryDelete = new CourseCommentCategoryDeleteViewModel();

            if (TokenManager.CheckToken(courseCommentCategoryDeleteViewModel._tenantName + courseCommentCategoryDeleteViewModel._userName, courseCommentCategoryDeleteViewModel._token))
            {
                courseCommentcategoryDelete = this.reportCardRepository.DeleteCourseCommentCategory(courseCommentCategoryDeleteViewModel);
            }
            else
            {
                courseCommentcategoryDelete._message = TOKENINVALID;
                courseCommentcategoryDelete._failure = true;
            }

            return(courseCommentcategoryDelete);
        }