コード例 #1
0
        public ActionResult Delete(DoctortypeModel N)
        {
            var d = db.tblDoctorTypes.SingleOrDefault(x => x.intTypeId == N.TypeId);

            db.tblDoctorTypes.Remove(d);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public ActionResult Delete(int?id)
        {
            tblDoctorType   D = db.tblDoctorTypes.SingleOrDefault(x => x.intTypeId == id);
            DoctortypeModel N = new DoctortypeModel()
            {
                TypeId = D.intTypeId,
                Type   = D.strType,
            };

            return(View(N));
        }
コード例 #3
0
        public ActionResult Create(DoctortypeModel D)
        {
            tblDoctorType dt = new tblDoctorType();

            dt.intTypeId = D.TypeId;
            dt.strType   = D.Type;

            db.tblDoctorTypes.Add(dt);
            db.SaveChanges();

            return(RedirectToAction("Index"));
        }
コード例 #4
0
        public ActionResult Index()
        {
            var dblist = db.tblDoctorTypes.ToList();
            List <DoctortypeModel> list = new List <DoctortypeModel>();

            foreach (tblDoctorType D in dblist)
            {
                DoctortypeModel dt = new DoctortypeModel();
                dt.TypeId = D.intTypeId;
                dt.Type   = D.strType;
                list.Add(dt);
            }
            return(View(list));
        }
コード例 #5
0
        public ActionResult Edit(DoctortypeModel dt)
        {
            tblDoctorType d = db.tblDoctorTypes.SingleOrDefault(x => x.intTypeId == dt.TypeId);


            if (d != null)
            {
                d.intTypeId = dt.TypeId;
                d.strType   = dt.Type;



                db.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }