예제 #1
0
파일: MyConvert.cs 프로젝트: adte/REC
 public TbType ConvertTyp(TypViewModel tbtype)
 {
     return new TbType()
     {
         TbTypeID = tbtype.TypID,
         Name = tbtype.TypName
     };
 }
예제 #2
0
        public ActionResult Create(TypViewModel tbtype)
        {
            var typ = convert.ConvertTyp(tbtype);

            if (ModelState.IsValid)
            {
                db.TbTypes.Add(typ);
                db.SaveChanges();
                return RedirectToAction("Index1");
            }

            return View(typ);
        }
예제 #3
0
        public ActionResult Edit(TypViewModel tbtype)
        {
            if (ModelState.IsValid)
            {
                TbType tbtypeOrg = db.TbTypes.First(p => p.TbTypeID == tbtype.TypID);
                tbtypeOrg.Name = tbtype.TypName;

                db.SaveChanges();
                return RedirectToAction("Index1");
            }
            return View(tbtype);
        }
예제 #4
0
        //
        // GET: /TbType/
        public ViewResult Index1()
        {
            var mymodel = new TypViewModel();
            mymodel.TypAll = db.TbTypes.ToList();

            return View(mymodel);
        }