public ActionResult Create([Bind(Include = "FormId,Name,Description,Date")] Form form)
        {
            if (ModelState.IsValid)
            {
                db.Forms.Add(form);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(form));
        }
        public ActionResult Popup()
        {
            db.FormList.Add(new FormList
            {
                FormName    = Request.Form["formName"],
                Description = Request.Form["formDescription"],
                CreatedAt   = DateTime.Now,
                CreatedBy   = 1,
                UserName    = Request.Form["name"],
                UserSurname = Request.Form["surname"],
                UserAge     = Convert.ToInt32(Request.Form["age"])
            });
            db.SaveChanges();

            return(RedirectToAction("Index", "FormList"));
        }
Пример #3
0
 public void AddForm(FormModel Form)
 {
     _context.Add(Form);
     _context.SaveChanges();
 }