I defined the name space of this class, you can see below,But it is very strange to say that the namespace was not defined in Method OnPostCreateOrEdit. There is a name space(using EducationManagement.Application.Contract.CourseLevel)
namespace EducationManagement.Application.Contract.CourseLevel {
public class EditCoursLevel
{
public long Id { get; set; }
public string Title { get; set; }
}
}
public JsonResult OnPostCreateOrEdit(long id, EditCourseLevel CourseLevel)
{
if (ModelState.IsValid)
{
if (id == 0)
{
_CourseLevelApplication.CreateLevel(CourseLevel);
_unitOfWork.Commit();
}
else
{
_CourseLevelApplication.EditCourseLevel(CourseLevel);
_unitOfWork.Commit();
}
lstLevel = _CourseLevelApplication.GetCourseLevelForDisplay();
var html = _renderService.ToString("_ViewAll", lstLevel);
return new JsonResult(new { isValid = true, html = html });
}
else
{
var html = _renderService.ToString("_CreateOrEdit", CourseLevel);
return new JsonResult(new { isValid = false, html = html });
}
}
CodePudding user response:
public class EditCoursLevel <-- TYPO! Change to EditCourseLevel
{
public long Id { get; set; }
public string Title { get; set; }
}