Beispiel #1
0
        public JsonResult AddOrEditBuidingCase(WebBuidingCase webca)
        {
            WebWorker worker = workerSer.GetWebWorkerByID(webca.WorkerID);
            int       ret    = 0;

            string[] list = null;
            string   thum = "";

            if (webca.textimg == "" || webca.textimg == null)
            {
            }
            else
            {
                list = ImageHelper.GetHvtImgUrls(webca.textimg);
                foreach (string item in list)
                {
                    thum += item + "|";
                }
                webca.textthumbnailImage = thum;
            }
            webca.UserID = worker.UserID;
            if (webca.id == 0)
            {
                ret = buidingcase.addBuidingCase(webca);
            }
            else
            {
                ret = buidingcase.updateBuidingCase(webca);
            }
            return(Json(new { RetCode = ret }));
        }
        public ActionResult mBuidingCaseDetail(int id = 0)
        {
            WebBuidingCase        buidingcase     = buidcaseSer.GetBuidingCaseByID(id);
            List <WebBuidingCase> buidingcaselist = buidcaseSer.GetBuidingCaseListByWorkerID(buidingcase.WorkerID);

            ViewBag.buidingcaselist = buidingcaselist;
            return(View(buidingcase));
        }
Beispiel #3
0
 public int addBuidingCase(WebBuidingCase buidingcase)
 {
     using (AIYunNetContext context = new AIYunNetContext())
     {
         context.WebBuidingCase.Add(buidingcase);
         context.SaveChanges();
         return(1);
     }
 }
Beispiel #4
0
 public int deleteBuidingCase(int id)
 {
     using (AIYunNetContext context = new AIYunNetContext())
     {
         WebBuidingCase ca = context.WebBuidingCase.Find(id);
         ca.DeleteOn = DateTime.Now;
         ca.IsDelete = 1;
         context.SaveChanges();
         return(1);
     }
 }
Beispiel #5
0
 public int updateBuidingCase(WebBuidingCase buidingcase)
 {
     using (AIYunNetContext context = new AIYunNetContext())
     {
         WebBuidingCase oldcase = context.WebBuidingCase.Find(buidingcase.id);
         oldcase.title              = buidingcase.title;
         oldcase.info               = buidingcase.info;
         oldcase.Address            = buidingcase.Address;
         oldcase.headimg            = buidingcase.headimg;
         oldcase.thumbnailImage     = buidingcase.thumbnailImage;
         oldcase.textimg            = buidingcase.textimg;
         oldcase.textthumbnailImage = buidingcase.textthumbnailImage;
         oldcase.sorting            = buidingcase.sorting;
         oldcase.EditOn             = DateTime.Now;
         context.SaveChanges();
         return(1);
     }
 }
Beispiel #6
0
        public WebBuidingCase GetBuidingCaseByID(int id)
        {
            WebBuidingCase buidingcse = new WebBuidingCase();

            using (AIYunNetContext context = new AIYunNetContext())
            {
                try
                {
                    buidingcse = context.WebBuidingCase.Find(id);
                    if (buidingcse == null)
                    {
                        buidingcse = new WebBuidingCase();
                    }
                }
                catch (Exception e)
                {
                }
                return(buidingcse);
            }
        }
Beispiel #7
0
        public ActionResult updateAndaddbuidingcase(int id = 0)
        {
            WebBuidingCase model = new WebBuidingCase();

            List <WebWorker> workerlist = new List <WebWorker>();

            workerlist = workerSer.GetWebWorkerList();
            IEnumerable <SelectListItem> list = workerlist.Select(com => new SelectListItem {
                Value = com.WorkerID.ToString(), Text = com.WorkerName
            });

            ViewBag.workerlist = list;

            if (id == 0)
            {
            }
            else
            {
                model = buidingcase.GetBuidingCaseByID(id);
            }

            return(View(model));
        }