Esempio n. 1
0
 public static FullTestEntity ToBllTest(this FullTestViewModel test)
 {
     return(new FullTestEntity
     {
         Id = test.Id,
         Name = test.TestName,
         Description = test.Description,
         TimeSec = test.TimeSec,
         Published = test.Published,
         UserId = test.UserId,
         Questions = test.Questions.Select(x => x.ToBllQuestion())
     });
 }
Esempio n. 2
0
        public ActionResult Edit(FullTestViewModel fullTest)
        {
            if (fullTest != null)
            {
                var test = new TestViewModel
                {
                    Id          = fullTest.Id,
                    TestName    = fullTest.TestName,
                    Description = fullTest.Description,
                    Published   = fullTest.Published,
                    TimeSec     = fullTest.TimeSec,
                    UserId      = userService.GetUserByNickname(User.Identity.Name).Id
                };
                testService.UpdateTest(test.ToBllTest());
            }
            else
            {
                return(View("NotFound"));
            }

            return(View("Index", testService.GetTestByName(fullTest.TestName).ToMvcTest()));
        }