我定義了這個類的命名空間,你可以在下面看到,但是說在Method OnPostCreateOrEdit中沒有定義命名空間很奇怪。有一個命名空間(使用 EducationManagement.Application.Contract.CourseLevel)
命名空間 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 });
}
}
uj5u.com熱心網友回復:
public class EditCoursLevel <-- TYPO! Change to EditCourseLevel
{
public long Id { get; set; }
public string Title { get; set; }
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/341136.html
標籤:asp.net asp.net-mvc asp.net核心 asp.net-web-api
上一篇:相關物體的Linq集團
下一篇:將zip檔案內容從網站傳輸給用戶
