public ActionResult Create() { var empty = new KnowledgeTestViewModel(); var data = empty.ToVM(); return(View(data)); }
public ActionResult Create(KnowledgeTestViewModel knowledgeTest) { if (!ModelState.IsValid) { ErrorNotification("Kayıt Eklenemedi!"); return(RedirectToAction("Create")); } _knowledgeTestService.Add(new KnowledgeTest { //TODO:Alanlar buraya yazılacak //Örn:BrandName = brand.BrandName, }); SuccessNotification("Kayıt Eklendi."); return(RedirectToAction("KnowledgeTestIndex")); }
public ActionResult Create(KnowledgeTestViewModel knowledgeTest) { if (!ModelState.IsValid) { ErrorNotification("Kayıt Eklenemedi!"); return(RedirectToAction("Create")); } _knowledgeTestService.Add(new KnowledgeTest { Question = knowledgeTest.Question, Answer1 = knowledgeTest.Answer1, Answer2 = knowledgeTest.Answer2, Answer3 = knowledgeTest.Answer3, Answer4 = knowledgeTest.Answer4, KnowledgeDate = DateTime.Now, Point = knowledgeTest.Point, IsActive = knowledgeTest.IsActive, ValidAnswerType = knowledgeTest.ValidAnswerType }); SuccessNotification("Kayıt Eklendi."); return(RedirectToAction("KnowledgeTestIndex")); }