Exemplo n.º 1
0
        public ActionResult Create(Project formProject)
        {
            if (ModelState.IsValid)
            {
                using (var tx = Db.BeginTransaction())
                {
                    Db.Save(formProject);
                    tx.Commit();

                    return RedirectToAction("Index");
                }
            }

            return View(formProject);
        }
Exemplo n.º 2
0
        public ActionResult Edit(int id, Project formItem)
        {
            if (ModelState.IsValid)
            {
                var item = Db.Get<Project>(id);
                if (item != null)
                {

                    var tx = Db.BeginTransaction();

                    Db.Update(item);

                    tx.Commit();

                    return RedirectToAction("Index");
                }

            }

            return View(formItem);
        }
Exemplo n.º 3
0
 public ActionResult Create()
 {
     var project = new Project();
     return View(project);
 }
Exemplo n.º 4
0
        public ActionResult Edit(int id, Project formProject)
        {
            if (ModelState.IsValid)
            {
                using (var tx = Db.BeginTransaction())
                {
                    var project = Db.Get<Project>(id);
                    if (project != null)
                    {
                        project.Name = formProject.Name;
                        project.Description = formProject.Description;

                        Db.Update(project);
                        tx.Commit();

                        return RedirectToAction("Index");
                    }

                }

            }

            return View(formProject);
        }