public ActionResult Create(Form model, FormCollection collection) { try { if (ModelState.IsValid) { FormsRepository.Add(model); FormsRepository.Save(); return RedirectToAction("Index"); } string mailViews = Server.MapPath("~/Views/UserMailer"); List<string> mailViewList = new List<string>(); foreach (string file in Directory.GetFiles(mailViews)) { mailViewList.Add(Path.GetFileNameWithoutExtension(file)); } SelectList mails = new SelectList(mailViewList); ViewBag.EmailViews = mails; return View(model); } catch { return View(); } }
public void Delete(Form item) { db.Forms.Remove(item); }
public void Delete(Form model) { db.Forms.Remove(model); }
// // Insert/Delete Methods public void Add(Form item) { db.Forms.Add(item); }
public void Add(Form form) { db.Forms.Add(form); }