Пример #1
0
        public ActionResult CameraCreate(CameraViewModel form)
        {
            var UserId = WebSecurity.GetUserId(User.Identity.Name);
            var user = UserProfileRepository.Find(Specification<EasyWeixin.Model.UserProfile>.Eval(o => o.UserId == UserId));
            form.UserId = WebSecurity.GetUserId(User.Identity.Name);
            form.AddDate = DateTime.Now;
            if (ModelState.IsValid)
            {
                PhotoWall pp = Mapper.Map<CameraViewModel, PhotoWall>(form);
                PhotoWallRepository.Add(pp);
                PhotoWallRepository.Context.Commit();
                switch (UserId.ToString())
                {
                    case "28":
                        //上海
                        pp.GetURL = "http://" + Request.Url.Host + "/ActivityCamare/CameraIndex?PhotoID=" + pp.ID + "&User_ID=" + user.ID;
                        break;

                    case "27":
                        //天津
                        pp.GetURL = "http://" + Request.Url.Host + "/ActivityCamare/TCameraIndex?PhotoID=" + pp.ID + "&User_ID=" + user.ID;
                        break;

                    case "29":
                        //武汉
                        pp.GetURL = "http://" + Request.Url.Host + "/ActivityCamare/WCameraIndex?PhotoID=" + pp.ID + "&User_ID=" + user.ID;
                        break;

                    case "32":
                        //云南
                        pp.GetURL = "http://" + Request.Url.Host + "/ActivityCamare/YCameraIndex?PhotoID=" + pp.ID + "&User_ID=" + user.ID;
                        break;

                    case "31":
                        //泰州
                        pp.GetURL = "http://" + Request.Url.Host + "/ActivityCamare/ZCameraIndex?PhotoID=" + pp.ID + "&User_ID=" + user.ID;
                        break;

                    case "25":
                        //深圳
                        pp.GetURL = "http://" + Request.Url.Host + "/ActivityCamare/SZCameraIndex?PhotoID=" + pp.ID + "&User_ID=" + user.ID;
                        break;

                    default:
                        pp.GetURL = "http://" + Request.Url.Host + "/ActivityCamare/CameraIndex?PhotoID=" + pp.ID + "&User_ID=" + user.ID;
                        break;
                }

                PhotoWallRepository.Update(pp);
                PhotoWallRepository.Context.Commit();
            }
            return Redirect("/CameraHouse/CameraIndex");
        }
Пример #2
0
 public ActionResult CameraEdit(CameraViewModel form)
 {
     if (ModelState.IsValid)
     {
         PhotoWall pp = PhotoWallRepository.GetByKey(form.ID);
         pp.PhotoTitle = form.PhotoTitle;
         pp.PhotoDesc = form.PhotoDesc;
         PhotoWallRepository.Update(pp);
         PhotoWallRepository.Context.Commit();
     }
     return Redirect("/CameraHouse/CameraIndex");
 }