Commit e1a43e73 authored by 黄奎's avatar 黄奎

页面修改

parent acd3aa1d
using Edu.AOP.CustomerAttribute;
using Edu.Common.Enum;
using Edu.Model.ViewModel.Course;
using Edu.Model.ViewModel.Question;
using Edu.Model.ViewModel.User;
using Edu.Repository.Course;
using Edu.Repository.Question;
using Edu.Repository.User;
using System.Collections.Generic;
using System.Linq;
......@@ -85,6 +87,11 @@ namespace Edu.Module.Course
/// </summary>
private readonly RB_TeacherRepository teacherRepository = new RB_TeacherRepository();
/// <summary>
/// 问题仓储层对象
/// </summary>
private readonly RB_QuestionRepository questionRepository = new RB_QuestionRepository();
#region 课程管理
/// <summary>
......@@ -216,8 +223,6 @@ namespace Edu.Module.Course
{nameof(RB_Course_ViewModel.UpdateTime),model.UpdateTime },
{nameof(RB_Course_ViewModel.Teacher_Ids),model.Teacher_Ids },
{nameof(RB_Course_ViewModel.CourseFeature),model.CourseFeature },
//{nameof(RB_Course_ViewModel.OriginalPrice),model.OriginalPrice },
//{nameof(RB_Course_ViewModel.SellPrice),model.SellPrice },
{nameof(RB_Course_ViewModel.IsOpenStepPrice),model.IsOpenStepPrice },
{nameof(RB_Course_ViewModel.IsRenew),model.IsRenew },
{nameof(RB_Course_ViewModel.RenewOgPrice),model.RenewOgPrice },
......@@ -860,7 +865,6 @@ namespace Edu.Module.Course
model.JobId = newId;
flag = newId > 0;
}
var oldJobDetailsList = course_JobDetailsRepository.GetCourseJobDetailsListRepository(new RB_Course_JobDetails_ViewModel() { JobId = model.JobId });
if (oldJobDetailsList == null || (oldJobDetailsList != null && oldJobDetailsList.Count == 0))
{
......@@ -869,6 +873,7 @@ namespace Edu.Module.Course
foreach (var item in model.JobDetailsList)
{
item.JobId = model.JobId;
item.QuestionId = SetQuestionModule(model,item);
flag = course_JobDetailsRepository.Insert(item) > 0;
}
}
......@@ -889,6 +894,7 @@ namespace Edu.Module.Course
}
foreach (var dItem in model.JobDetailsList)
{
dItem.QuestionId = SetQuestionModule(model, dItem);
dItem.JobId = model.JobId;
if (dItem.DetailsId == 0)
{
......@@ -904,6 +910,57 @@ namespace Edu.Module.Course
return flag;
}
/// <summary>
/// 处理作业问题
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public int SetQuestionModule(RB_Course_Job_ViewModel jobModel,RB_Course_JobDetails_ViewModel item)
{
var model = new RB_Question_ViewModel()
{
QuestionId = item.QuestionId,
CourseId = jobModel.CourseId,
Title = item.Title,
QuestionContent = item.QuestionContent,
DifficultyType = item.DifficultyType,
AnswerParse = item.AnswerParse,
QuestionTypeId=item.QuestionTypeId,
QuestionTypeName=item.QuestionTypeKey,
Knowledge=item.Knowledge,
CreateBy= jobModel.CreateBy,
CreateTime= jobModel.CreateTime,
UpdateBy=jobModel.UpdateBy,
UpdateTime=jobModel.UpdateTime,
IsUpdateJobExam=item.IsUpdateJobExam,
Status=0,
SortNum=0,
Answer=item.Answer,
IsMutex=item.IsMutex,
Category=item.Category,
LevelType=item.LevelType,
};
if (model.QuestionId > 0)
{
var newId = questionRepository.Insert(model);
model.QuestionId = newId;
if (newId>0)
{
Dictionary<string, object> sortFileds = new Dictionary<string, object>()
{
{nameof(RB_Question_ViewModel.SortNum),newId },
};
//更新问题排序
questionRepository.Update(sortFileds, new WhereHelper(nameof(RB_Question_ViewModel.QuestionId), newId));
}
}
else
{
questionRepository.Update(model);
}
return model.QuestionId;
}
/// <summary>
/// 设置作业其他配置
/// </summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment