public ActionResult AddScheduleTest(FormCollection colection, ScheduleTest ScheduleTest) { int? DeviceId = colection["DeviceId"].Equals("") ? (int?)null : Convert.ToInt32(colection["DeviceId"]); DateTime?DateOfTest = colection["DateOfTest"].Equals("") ? (DateTime?)null : Convert.ToDateTime(colection["DateOfTest"]); DateTime?NextDateOfTest = colection["NextDateOfTest"].Equals("") ? (DateTime?)null : Convert.ToDateTime(colection["NextDateOfTest"]); String CategoryTest = colection["CategoryTest"]; int? UserTest = colection["UserTest"].Equals("0") ? (int?)null : Convert.ToInt32(colection["UserTest"]); String Notes = colection["Notes"]; Ql.AddScheduleTest(DeviceId, DateOfTest, NextDateOfTest, CategoryTest, UserTest, Notes); return(RedirectToAction("ScheduleTest", "ScheduleTest")); }