public ActionResult Create(Homework homework)
        {
            try
            {
                ViewBag.StudentId = new SelectList(studentService.GetActive(), "ID", "StudentName");
                ViewBag.CourseId  = new SelectList(courseService.GetActive(), "ID", "CourseName");

                homeworkService.Add(homework);
                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                TempData["Error"] = e.Message;
                return(View());
            }
        }
Пример #2
0
        public void testAddStandaloneHomework()
        {
            Assert.Null(serv.GetByDetails(hwTitl, hwDesc));
            // Arrange
            int count = serv.All().Count();


            // Act
            MichtavaResult res = serv.Add(entity);

            // Assert
            Assert.AreEqual(count + 1, serv.All().Count());
            Assert.NotNull(serv.GetByDetails(hwTitl, hwDesc));
            Assert.True(res is MichtavaSuccess);
            Assert.True(serv.HardDelete(entity) is MichtavaSuccess);
        }