Hi I have a method in my controller and has the following code
if (ModelState.IsValid)
{
IDataOperations ops = DataSession.GetDataOperations(null);
List<Department> dept = new List<Department>();
ops.Load(dept);
ops.Commit();
int deptId = dept[dept.Count - 1].Id + 1;
Department department = new Department()
{
Id = deptId,
CompanyId = deptModel.CompanyId,
Active = deptModel.Active,
Name = deptModel.Name
};
ops.Create(department);
ops.Commit();
return RedirectToAction("CompanyDepartment", "Task");
}
else
{
//some code
Every time the page runs it always goes to the else part, meaning model-state is invalid. How do I check where the error in the page is, what code can I add to show where the error in the page is.
Thank you