Пример #1
0
        public ActionResult Del(int id)
        {
            Sanatorium.Models.Sanatorium sanatorium = db.Sanatoriums.Find(id);
            if (sanatorium == null)
            {
                return(RedirectToAction("Index"));
            }

            db.Sanatoriums.Remove(sanatorium);

            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
        public ActionResult EditZhiDuInfo(ZhiDuViewModel model)
        {
            if (ModelState.IsValid)
            {
                Sanatorium.Models.Sanatorium sanatorium = db.Sanatoriums.Find(model.Id);
                if (sanatorium == null)
                {
                    return(RedirectToAction("Index"));
                }

                sanatorium.ShiGongZhidu  = model.ShiGongZhidu;
                sanatorium.AnQuanZhiDu   = model.AnQuanZhiDu;
                sanatorium.XiaoFangZhidu = model.XiaoFangZhidu;

                db.Entry(sanatorium).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();

                ModelState.AddModelError("", "操作成功");
                TempData["ModelState"] = ModelState;
                return(RedirectToAction("EditXiaoZuInfo", new { id = model.Id }));
            }
            SetMyAccountViewModel();
            return(View(model));
        }
Пример #3
0
        public ActionResult Add(int id)
        {
            var model = new SanatoriumViewModel();

            if (id > 0)
            {
                //编辑
                Sanatorium.Models.Sanatorium sanatorium = db.Sanatoriums.Find(id);
                {
                    if (sanatorium != null)
                    {
                        model.Id                = id;
                        model.Name              = sanatorium.Name;
                        model.Pics              = sanatorium.Pics;
                        model.Region            = sanatorium.Region;
                        model.Street            = sanatorium.Street;
                        model.Community         = sanatorium.Community;
                        model.Address           = sanatorium.Address;
                        model.StagingCount      = sanatorium.StagingCount;
                        model.CompletionYear    = sanatorium.CompletionYear;
                        model.BuildingsCount    = sanatorium.BuildingsCount;
                        model.StructureArea     = sanatorium.StructureArea;
                        model.FinishArea        = sanatorium.FinishArea;
                        model.DoingArea         = sanatorium.DoingArea;
                        model.ToDoArea          = sanatorium.ToDoArea;
                        model.ShiShiOrg         = sanatorium.ShiShiOrg;
                        model.ShiGongOrg        = sanatorium.ShiGongOrg;
                        model.StartTime         = sanatorium.StartTime;
                        model.FinishTime        = sanatorium.FinishTime;
                        model.PredictFinishTime = sanatorium.PredictFinishTime;

                        model.BuildOrg          = sanatorium.BuildOrg;
                        model.BuildOrgPrincipal = sanatorium.BuildOrgPrincipal;
                        model.BuildOrgPhone     = sanatorium.BuildOrgPhone;
                        model.BuildOrgWeb       = sanatorium.BuildOrgWeb;

                        model.DesignOrg          = sanatorium.DesignOrg;
                        model.DesignOrgPrincipal = sanatorium.DesignOrgPrincipal;
                        model.DesignOrgPhone     = sanatorium.DesignOrgPhone;
                        model.DesignOrgWeb       = sanatorium.DesignOrgWeb;

                        model.SupervisionOrg          = sanatorium.SupervisionOrg;
                        model.SupervisionOrgPrincipal = sanatorium.SupervisionOrgPrincipal;
                        model.SupervisionOrgPhone     = sanatorium.SupervisionOrgPhone;
                        model.SupervisionOrgWeb       = sanatorium.SupervisionOrgWeb;

                        model.GongZiPhone = sanatorium.GongZiPhone;
                        model.JuMinPhone  = sanatorium.JuMinPhone;



                        model.Remark = sanatorium.Remark;
                    }
                    else
                    {
                        //未找到该项目
                    }
                }
            }

            //选择项目
            //var hremoves = db.HRemoves.Where(h => h.Id > 0).ToList();
            //var selectList = new SelectList(hremoves, "Name", "Name");
            //ViewData["list"] = selectList;

            var regions    = db.Regions.Where(c => c.Id > 0).ToList();
            var regionList = new SelectList(regions, "Name", "Name");

            var streets    = db.Streets.Where(c => c.Id > 0).ToList();
            var streetList = new SelectList(streets, "Name", "Name");

            var communitys    = db.Communitys.Where(c => c.Id > 0).ToList();
            var communityList = new SelectList(communitys, "Name", "Name");

            ViewData["regions"]    = regionList;
            ViewData["streets"]    = streetList;
            ViewData["communitys"] = communityList;

            SetMyAccountViewModel();
            return(View(model));
        }