Example #1
0
 public Issue ToIssue(ViewIssue issueV)
 {
     return new Issue()
     {
         Id = issueV.IdV,
         Name = issueV.NameV,
         Text = issueV.TextV,
         Type = issueV.TypeV,
         IdType = issueV.IdTypeV
     };
 }
Example #2
0
        public ActionResult Create(ViewIssue issueV)
        {
            if (ModelState.IsValid)
            {
                db.Issues.Add(swap.ToIssue(issueV));
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.IdTypeV = new SelectList(db.Types, "Id", "Name", issueV.IdTypeV);

            return View(issueV);
        }
Example #3
0
        public ActionResult Edit(ViewIssue issueV)
        {
            if (ModelState.IsValid)
            {
                Issue issueOrg = db.Issues.First(p => p.Id == issueV.IdV);
                issueOrg.Name = issueV.NameV;
                issueOrg.Text = issueV.TextV;
                issueOrg.Type = issueV.TypeV;
                issueOrg.IdType = issueV.IdTypeV;

                db.SaveChanges();
                return RedirectToAction("Index");
            }
            ViewBag.IdTypeV = new SelectList(db.Types, "Id", "Name", issueV.IdTypeV);
            return View(issueV);
        }
Example #4
0
        // GET: /Issue/
        public ViewResult Index()
        {
            ViewIssue model = new ViewIssue();
            model.ListViewIssue = db.Issues.ToList();

            return View(model);
        }