Commit e0819e9d authored by 黄奎's avatar 黄奎

新增验证

parent b80cf891
......@@ -531,6 +531,25 @@ namespace Edu.Module.Course
return class_PlanRepository.DeleteOne(new WhereHelper(nameof(RB_Class_Plan_ViewModel.ClassPlanId), ClassPlanId));
}
/// <summary>
/// 检查班级上课日期是否存在
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool CheckPlanModule(RB_Class_Plan_ViewModel extModel)
{
List<WhereHelper> list = new List<WhereHelper>()
{
new WhereHelper (nameof(RB_Class_Plan_ViewModel.ClassId),extModel.ClassId),
new WhereHelper (nameof(RB_Class_Plan_ViewModel.ClassDate),extModel.ClassDate),
};
if (extModel.ClassPlanId > 0)
{
list.Add(new WhereHelper(nameof(RB_Class_Plan_ViewModel.ClassPlanId), extModel.ClassPlanId, OperatorEnum.NotEqual));
}
return class_PlanRepository.Exists(list);
}
/// <summary>
/// 新增修改班级上课计划
/// </summary>
......
......@@ -260,6 +260,10 @@ namespace Edu.WebApi.Controllers.Course
TeacherId = base.ParmJObj.GetInt("TeacherId"),
Group_Id = base.UserInfo.Group_Id,
};
if (classModule.CheckPlanModule(extModel))
{
return ApiResult.Failed(message: "已经存在【"+Common.ConvertHelper.FormatDate(extModel.ClassDate)+"】的上课安排!请删除后再操作!");
}
extModel.School_Id = classModule.GetClassModule(extModel.ClassId)?.School_Id ?? 0;
try
{
......
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