Exemplo n.º 1
0
        // GET: /TbIssue/Create
        public ActionResult Create()
        {
            var model = new IssueViewModel();
            model.List = db.TbTypes;

            return View(model);
        }
Exemplo n.º 2
0
        // GET: /TbIssue/Edit/5
        public ActionResult Edit(int id)
        {
            TbIssue tbissueOrg = db.TbIssues.First(p => p.TbIssueID == id);
            var model = new IssueViewModel();
            model = convert.ConvertIssueToView(tbissueOrg);
            model.List = db.TbTypes;

            return View(model);
        }
Exemplo n.º 3
0
 public TbIssue ConvertIssue(IssueViewModel tbissue)
 {
     return new TbIssue()
     {
         TbIssueID = tbissue.IssueId,
         Name = tbissue.IssueName,
         Text = tbissue.IssueText,
         TbType = tbissue.TbtypeN
     };
 }
Exemplo n.º 4
0
        public ActionResult Create(IssueViewModel tbissue)
        {
            if (ModelState.IsValid)
            {
                var z = db.TbTypes.First(p => p.TbTypeID == tbissue.TbtypeN.TbTypeID);
                tbissue.TbtypeN = z;

                db.TbIssues.Add(convert.ConvertIssue(tbissue));
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(tbissue);
        }
Exemplo n.º 5
0
        public ActionResult Edit(IssueViewModel tbissue)
        {
            TbIssue tbissueOrg;
            //var issue = convert.ConvertIssue(tbissue);
            if (ModelState.IsValid)
            {
                tbissueOrg = db.TbIssues.First(p => p.TbIssueID == tbissue.IssueId);
                tbissueOrg.Name = tbissue.IssueName;
                tbissueOrg.Text = tbissue.IssueText;
                tbissueOrg.TbType = db.TbTypes.First(p=>p.TbTypeID == tbissue.TbtypeN.TbTypeID);

                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(tbissue);
        }
Exemplo n.º 6
0
        // GET: /TbIssue/
        public ViewResult Index()
        {
            var mymodel = new IssueViewModel();
            mymodel.IssueAll = db.TbIssues.Include(p => p.TbType);

            return View(mymodel);
        }