/// <summary>
        /// 验证邮箱
        /// </summary>
        /// <param name="account">账号</param>
        /// <param name="email">输入的邮箱</param>
        /// <returns>成功 or 失败,错误信息</returns>
        public static RequestResult ValidateEmail(string account, string email)
        {
            using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
            {
                var hasAccount = _db.tbl_UserAccount.Where(p => p.user_Account == account).ToList();

                if (hasAccount.Count() == 0)
                {
                    return(new RequestResult()
                    {
                        Succeeded = false, Error = "用户名不存在"
                    });
                }
                else if (hasAccount[0].user_EmailAddress != email)
                {
                    return(new RequestResult()
                    {
                        Succeeded = false, Error = "电子邮件错误"
                    });
                }
                else
                {
                    return(new RequestResult()
                    {
                        Succeeded = true
                    });
                }
            }
        }
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="account">账号</param>
        /// <param name="oldpassword">原密码</param>
        /// <param name="newpassword">新密码</param>
        /// <returns>成功 or 失败,错误信息</returns>
        public static RequestResult ChangePassword(string account, string oldpassword, string newpassword)
        {
            if (oldpassword == newpassword)
            {
                return(new RequestResult()
                {
                    Succeeded = false, Error = "新密码不能与原密码相同"
                });
            }
            using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
            {
                oldpassword = DESEncryption.DesEncrypt(oldpassword);
                var rightPassword = _db.tbl_UserAccount.Where(p => p.user_Account == account && p.user_Password == oldpassword).ToList();

                if (rightPassword.Count() == 0)
                {
                    return(new RequestResult()
                    {
                        Succeeded = false, Error = "原密码输入错误"
                    });
                }
                else
                {
                    newpassword = DESEncryption.DesEncrypt(newpassword);
                    var newAccount = _db.tbl_UserAccount.SingleOrDefault(p => p.user_Account == account);
                    newAccount.user_Password = newpassword;
                    _db.SubmitChanges();
                    _db.AlterUserAlterTime(newAccount.user_Id);
                    return(new RequestResult()
                    {
                        Succeeded = true, Error = "密码 更改成功"
                    });
                }
            }
        }
        /// <summary>
        /// 修改封面
        /// </summary>
        /// <param name="model"></param>
        /// <returns>成功 or 失败,错误信息</returns>
        public static RequestResult ChangeCover(ChangeCoverViewModel model)
        {
            using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
            {
                bool hasModified = false;
                var  account     = _db.tbl_UserAccount.SingleOrDefault(p => p.user_Id == model.Id);

                if (model.Cover != account.user_Avatar && !string.IsNullOrEmpty(model.Cover) && !string.IsNullOrWhiteSpace(model.Cover))
                {
                    account.user_Cover = model.Cover;
                    hasModified        = true;
                }

                if (hasModified)
                {
                    _db.SubmitChanges();
                    _db.AlterUserAlterTime(account.user_Id);
                    return(new RequestResult()
                    {
                        Succeeded = true
                    });
                }
                else
                {
                    return(new RequestResult()
                    {
                        Error = "没有改变。。。"
                    });
                }
            }
        }
        public ActionResult Index(string search, int page = 1)
        {
            MR_DataClassesDataContext _db = new MR_DataClassesDataContext();
            var query = from m in _db.tbl_Resource
                        select m;

            if (!string.IsNullOrWhiteSpace(search) && !string.IsNullOrEmpty(search))
            {
                search = search.ToLower();
                query  = (IOrderedQueryable <tbl_Resource>)query.Where(s => s.res_Name.ToLower().Contains(search) || s.res_Content.ToLower().Contains(search));
            }
            query = query.Skip((page - 1) * 20).Take(20).OrderByDescending(m => m.res_Time);
            List <ResViewModel> ress = new List <ResViewModel>();

            foreach (var item in query)
            {
                if (!string.IsNullOrEmpty(item.res_User) && !string.IsNullOrWhiteSpace(item.res_User))
                {
                    ress.Add(new ResViewModel(item));
                }
            }

            FilterResViewModel resModel = new FilterResViewModel();

            resModel.Ress   = ress;
            resModel.Search = search;
            resModel.Page   = page;
            return(View(resModel));
        }
Exemple #5
0
        /// <summary>
        /// 创建评论
        /// </summary>
        /// <param name="content">评论内容</param>
        /// <param name="movie">评论的电影id</param>
        /// <param name="user">用户id</param>
        /// <returns>评论id</returns>
        public static string Create(string content, string movie, string user)
        {
            using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
            {
                tbl_Comment cmt = new tbl_Comment()
                {
                    cmt_Content = content,
                    cmt_User    = user,
                    cmt_Movie   = movie
                };

                string guid;
                do
                {
                    guid = Guid.NewGuid().ToString("N").ToUpper();
                } while (_db.tbl_Comment.Where(p => p.cmt_Id == guid).Count() != 0);
                cmt.cmt_Id = guid;

                _db.tbl_Comment.InsertOnSubmit(cmt);
                _db.SubmitChanges();
                _db.SetCmtTime(guid);

                return(cmt.cmt_Id);
            }
        }
Exemple #6
0
        /// <summary>
        /// 创建求资源
        /// </summary>
        /// <param name="model"></param>
        public static void Create(ManageAskViewModel model)
        {
            using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
            {
                tbl_Ask ask = new tbl_Ask()
                {
                    ask_Movie = model.MovieId,
                    ask_Note  = model.Note,
                    ask_State = false,
                    ask_With  = 0
                };
                if (model.User != null)
                {
                    ask.ask_User = model.User;
                }
                string guid;
                do
                {
                    guid = Guid.NewGuid().ToString("N").ToUpper();
                } while (_db.tbl_Ask.Where(p => p.ask_Id == guid).Count() != 0);
                ask.ask_Id = guid;

                _db.tbl_Ask.InsertOnSubmit(ask);
                _db.SubmitChanges();
                _db.SetAskTime(guid);
            }
        }
        public ActionResult CreateMovie(ManageMovieViewModel movie, System.Web.HttpPostedFileBase file)
        {
            if (!ModelState.IsValid)
            {
                return(View(movie));
            }
            if (file != null && file.ContentLength > 0)
            {
                var fileName = System.IO.Path.Combine(Request.MapPath("~/Content/Movie/"), System.IO.Path.GetFileName(file.FileName));
                file.SaveAs(fileName);
                movie.Avatar = System.IO.Path.GetFileName(file.FileName);
            }
            MR_DataClassesDataContext _db = new MR_DataClassesDataContext();

            if ((bool)_db.tbl_UserAccount.SingleOrDefault(u => u.user_Account == User.Identity.Name).user_IsAdmin)
            {
                movie.Status = 2;
            }
            else
            {
                movie.Status = 0;
            }
            movie.Create = AccountManager.GetId(User.Identity.Name);
            string newId = MovieManager.CreateMovie(movie);

            return(RedirectToAction("Index", new { id = newId }));
        }
        /// <summary>
        /// 通过json创建影人
        /// </summary>
        /// <param name="json">json</param>
        /// <param name="mappath">影人海报保存地址</param>
        /// <param name="create">影人创建者</param>
        /// <returns></returns>
        public static string CreateJson(JObject json, string mappath, string create)
        {
            using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
            {
                var createCeleb = new tbl_Celebrity();
                createCeleb = CelebManager.JsonToCeleb(json, mappath);

                string guid;
                do
                {
                    guid = Guid.NewGuid().ToString("N").ToUpper();
                } while (_db.tbl_Celebrity.Where(p => p.celeb_Id == guid).Count() != 0);
                createCeleb.celeb_Id     = guid;
                createCeleb.celeb_Create = create;
                if ((bool)_db.tbl_UserAccount.SingleOrDefault(u => u.user_Id == create).user_IsAdmin)
                {
                    createCeleb.celeb_Status = 2;
                }
                else
                {
                    createCeleb.celeb_Status = 0;
                }

                _db.tbl_Celebrity.InsertOnSubmit(createCeleb);
                _db.SubmitChanges();
                _db.SetCelebTime(guid);

                if (!string.IsNullOrEmpty(createCeleb.celeb_DoubanID))
                {
                    MovieManager.RefreshCeleb(createCeleb.celeb_Id, createCeleb.celeb_DoubanID);
                }

                return(createCeleb.celeb_Id);
            }
        }
        //
        // GET: /Home/Test/
        public ActionResult Test()
        {
            MR_DataClassesDataContext _db = new MR_DataClassesDataContext();

            foreach (var celeb in _db.tbl_Celebrity)
            {
                if (celeb.celeb_DoubanID != null)
                {
                    foreach (var item in _db.tbl_Movie)
                    {
                        if (item.movie_DirectorsId != null && item.movie_DirectorsId.Contains(celeb.celeb_DoubanID))
                        {
                            item.movie_DirectorsId.Replace(celeb.celeb_DoubanID, celeb.celeb_Id);
                        }
                        if (item.movie_WritersId != null && item.movie_WritersId.Contains(celeb.celeb_DoubanID))
                        {
                            item.movie_WritersId.Replace(celeb.celeb_DoubanID, celeb.celeb_Id);
                        }
                        if (item.movie_CastsId != null && item.movie_CastsId.Contains(celeb.celeb_DoubanID))
                        {
                            item.movie_CastsId.Replace(celeb.celeb_DoubanID, celeb.celeb_Id);
                        }
                    }
                }
            }
            _db.SubmitChanges();
            return(RedirectToAction("Index"));
        }
Exemple #10
0
        /// <summary>
        /// 创建专辑
        /// </summary>
        /// <param name="model"></param>
        /// <returns>专辑id</returns>
        public static string Create(ManageAlbumViewModel model)
        {
            using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
            {
                tbl_Album album = new tbl_Album()
                {
                    album_Title   = model.Title,
                    album_Summary = model.Summary,
                    album_User    = model.UserId,
                    album_Cover   = model.Cover
                };

                string guid;
                do
                {
                    guid = Guid.NewGuid().ToString("N").ToUpper();
                } while (_db.tbl_Album.Where(p => p.album_Id == guid).Count() != 0);
                album.album_Id    = guid;
                album.album_Item  = "[]";
                album.album_Visit = 0;

                _db.tbl_Album.InsertOnSubmit(album);
                _db.SubmitChanges();
                _db.SetAlbumTime(guid);

                return(album.album_Id);
            }
        }
        /// <summary>
        /// 更新所有电影信息中导演、演员、编剧id
        /// </summary>
        /// <param name="celeb">影人id</param>
        /// <param name="douban">影人豆瓣id</param>
        public static void RefreshCeleb(string celeb, string douban)
        {
            using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
            {
                var movies = _db.tbl_Movie;

                foreach (var item in movies)
                {
                    if (!string.IsNullOrEmpty(item.movie_DirectorsId) && item.movie_DirectorsId.Contains(douban))
                    {
                        item.movie_DirectorsId = item.movie_DirectorsId.Replace(douban, celeb);
                    }
                    if (!string.IsNullOrEmpty(item.movie_WritersId) && item.movie_WritersId.Contains(douban))
                    {
                        item.movie_WritersId = item.movie_WritersId.Replace(douban, celeb);
                    }
                    if (!string.IsNullOrEmpty(item.movie_CastsId) && item.movie_CastsId.Contains(douban))
                    {
                        item.movie_CastsId = item.movie_CastsId.Replace(douban, celeb);
                    }
                }

                _db.SubmitChanges();
            }
        }
Exemple #12
0
        /// <summary>
        /// 添加每日发现电影
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static string Create(ManageDiscViewModel model)
        {
            using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
            {
                tbl_Discovery disc = new tbl_Discovery()
                {
                    disc_Movie = model.Movie,
                    disc_Image = model.Image
                };

                string guid;
                do
                {
                    guid = Guid.NewGuid().ToString("N").ToUpper();
                } while (_db.tbl_Discovery.Where(p => p.disc_Id == guid).Count() != 0);
                disc.disc_Id   = guid;
                disc.disc_Flag = _db.tbl_Discovery.OrderByDescending(d => d.disc_Flag).ToList()[0].disc_Flag + 1;

                _db.tbl_Discovery.InsertOnSubmit(disc);
                _db.SubmitChanges();
                _db.SetDiscTime(guid);

                return(disc.disc_Id);
            }
        }
        /// <summary>
        /// 通过json创建电影
        /// </summary>
        /// <param name="json">json</param>
        /// <param name="mappath">电影海报保存地址</param>
        /// <param name="create">电影创建者</param>
        /// <returns></returns>
        public static string CreateJson(JObject json, string mappath, string create)
        {
            using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
            {
                var createMovie = new tbl_Movie();
                createMovie = MovieManager.JsonToMovie(json, mappath);

                string guid;
                do
                {
                    guid = Guid.NewGuid().ToString("N").ToUpper();
                } while (_db.tbl_Movie.Where(p => p.movie_Id == guid).Count() != 0);
                createMovie.movie_Id         = guid;
                createMovie.movie_Create     = create;
                createMovie.movie_VisitCount = 0;
                if ((bool)_db.tbl_UserAccount.SingleOrDefault(u => u.user_Id == create).user_IsAdmin)
                {
                    createMovie.movie_Status = 2;
                }
                else
                {
                    createMovie.movie_Status = 0;
                }

                _db.tbl_Movie.InsertOnSubmit(createMovie);
                _db.SubmitChanges();
                _db.SetMovieTime(guid);

                return(createMovie.movie_Id);
            }
        }
 public ActionResult Edit(ManageMovieViewModel model, System.Web.HttpPostedFileBase file)
 {
     if (!ModelState.IsValid)
     {
         return(View(model));
     }
     if (file != null && file.ContentLength > 0)
     {
         var fileName = System.IO.Path.Combine(Request.MapPath("~/Content/Movie/"), System.IO.Path.GetFileName(file.FileName));
         file.SaveAs(fileName);
         model.Avatar = System.IO.Path.GetFileName(file.FileName);
         string oldAvatar = _db.tbl_Movie.SingleOrDefault(m => m.movie_Id == model.Id).movie_Avatar;
         if (oldAvatar != "Movie_Default.png")
         {
             ImageManager.Delete(Server.MapPath("~/Content/Movie/" + oldAvatar));
         }
     }
     else
     {
         MR_DataClassesDataContext _db = new MR_DataClassesDataContext();
         model.Avatar = _db.tbl_Movie.SingleOrDefault(m => m.movie_Id == model.Id).movie_Avatar;
     }
     MovieManager.Edit(model);
     return(RedirectToAction("Index", new { id = model.Id }));
 }
Exemple #15
0
        /// <summary>
        /// 创建资源
        /// </summary>
        /// <param name="model"></param>
        public static void Create(ManageResViewModel model)
        {
            using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
            {
                tbl_Resource res = new tbl_Resource()
                {
                    res_Movie      = model.MovieId,
                    res_Name       = model.FileName,
                    res_Content    = model.Content,
                    res_Size       = float.Parse(model.FileSize),
                    res_Type       = model.ResType,
                    res_FavorCount = 0,
                    res_Status     = model.Status
                };
                if (model.User != null)
                {
                    res.res_User = model.User;
                }
                string guid;
                do
                {
                    guid = Guid.NewGuid().ToString("N").ToUpper();
                } while (_db.tbl_Resource.Where(p => p.res_Id == guid).Count() != 0);
                res.res_Id = guid;

                _db.tbl_Resource.InsertOnSubmit(res);
                _db.SubmitChanges();
                _db.SetResTime(guid);
            }
        }
        public AlbumViewModel(tbl_Album album)
        {
            Id          = album.album_Id;
            Title       = album.album_Title;
            Summary     = album.album_Summary;
            Cover       = album.album_Cover;
            UserId      = album.album_User;
            UserAccount = AccountManager.GetAccount(album.album_User);
            CreateTime  = ((DateTime)album.album_Time).Date.ToShortDateString();
            AlterTime   = ((DateTime)album.album_AlterTime).Date.ToShortDateString();

            MR_DataClassesDataContext _db = new MR_DataClassesDataContext();

            ItemJson = album.album_Item;


            var others = _db.tbl_Album.Where(a => a.album_User == album.album_User);

            Albums = new List <AlbumListItem>();
            foreach (var item in others)
            {
                if (item.album_Id != album.album_Id)
                {
                    Albums.Add(new AlbumListItem(item));
                }
            }
            IsCreator = false;
            HasFollow = false;
        }
 /// <summary>
 /// 登录
 /// </summary>
 /// <param name="account">用户名</param>
 public static void SignIn(string account)
 {
     using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
     {
         var loginAccount = _db.tbl_UserAccount.Single(p => p.user_Account == account);
         FormsAuthentication.SetAuthCookie(account, false);
     }
 }
 /// <summary>
 /// 删除电影
 /// </summary>
 /// <param name="id">电影id</param>
 public static void Delete(string id)
 {
     using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
     {
         tbl_Movie movie = _db.tbl_Movie.SingleOrDefault(s => s.movie_Id == id);
         _db.tbl_Movie.DeleteOnSubmit(movie);
         _db.SubmitChanges();
     }
 }
Exemple #19
0
 /// <summary>
 /// 访问电影,专辑的访问量+1
 /// </summary>
 /// <param name="id">专辑id</param>
 public static void Visit(string id)
 {
     using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
     {
         tbl_Album album = _db.tbl_Album.SingleOrDefault(a => a.album_Id == id);
         album.album_Visit++;
         _db.SubmitChanges();
     }
 }
        public HomeDiscViewModel(tbl_Discovery dis)
        {
            Id = dis.disc_Id;
            MR_DataClassesDataContext _db = new MR_DataClassesDataContext();

            Movie = new MovieViewModel(_db.tbl_Movie.SingleOrDefault(m => m.movie_Id == dis.disc_Movie));
            Image = dis.disc_Image;
            Flag  = dis.disc_Flag;
        }
 /// <summary>
 /// 访问电影,电影的访问量+1
 /// </summary>
 /// <param name="id">电影id</param>
 public static void Visit(string id)
 {
     using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
     {
         tbl_Movie movie = _db.tbl_Movie.SingleOrDefault(s => s.movie_Id == id);
         movie.movie_VisitCount++;
         _db.SubmitChanges();
     }
 }
 /// <summary>
 /// 删除影人
 /// </summary>
 /// <param name="id"></param>
 public static void Delete(string id)
 {
     using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
     {
         tbl_Celebrity celeb = _db.tbl_Celebrity.SingleOrDefault(s => s.celeb_Id == id);
         _db.tbl_Celebrity.DeleteOnSubmit(celeb);
         _db.SubmitChanges();
     }
 }
Exemple #23
0
 /// <summary>
 /// 取消求资源
 /// </summary>
 /// <param name="id">求资源id</param>
 public static void Delete(string id)
 {
     using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
     {
         tbl_Ask ask = _db.tbl_Ask.SingleOrDefault(s => s.ask_Id == id);
         _db.tbl_Ask.DeleteOnSubmit(ask);
         _db.SubmitChanges();
     }
 }
Exemple #24
0
 /// <summary>
 /// 删除资源
 /// </summary>
 /// <param name="id">资源id</param>
 public static void Delete(string id)
 {
     using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
     {
         tbl_Resource res = _db.tbl_Resource.SingleOrDefault(s => s.res_Id == id);
         _db.tbl_Resource.DeleteOnSubmit(res);
         _db.SubmitChanges();
     }
 }
        //
        // GET: /Search/
        public ActionResult Index(string search, string genre = "0", string country = "0", string year = "0", int page = 1)
        {
            MR_DataClassesDataContext _db        = new MR_DataClassesDataContext();
            ClassifyViewModel         movieGroup = new ClassifyViewModel();
            var filterMovie = from m in _db.tbl_Movie
                              where m.movie_Status == 2
                              select m;

            if (!string.IsNullOrEmpty(search) && !string.IsNullOrWhiteSpace(search))
            {
                filterMovie = filterMovie.Where(m => m.movie_Title.Contains(search) || m.movie_TitleEn.Contains(search) || m.movie_Aka.Contains(search));
            }
            if (genre != "0")
            {
                filterMovie = filterMovie.Where(m => m.movie_Genres.IndexOf(genre) > -1);
            }
            if (country != "0")
            {
                filterMovie = filterMovie.Where(m => m.movie_Countries.IndexOf(country) > -1);
            }
            if (year != "0")
            {
                filterMovie = filterMovie.Where(m => m.movie_Year == year);
            }
            filterMovie.OrderByDescending(m => m.movie_Time);
            movieGroup.listMovies.Clear();
            foreach (var item in filterMovie)
            {
                MovieViewModel movie = new MovieViewModel(item);
                movie.IsPlan   = MarkManager.Validate(item.movie_Id, AccountManager.GetId(User.Identity.Name), 1);
                movie.IsFinish = MarkManager.Validate(item.movie_Id, AccountManager.GetId(User.Identity.Name), 2);
                movie.IsFavor  = MarkManager.Validate(item.movie_Id, AccountManager.GetId(User.Identity.Name), 3);
                movieGroup.listMovies.Add(movie);
            }
            movieGroup.Count   = movieGroup.listMovies.Count();
            movieGroup.Search  = search;
            movieGroup.Genre   = genre;
            movieGroup.Country = country;
            movieGroup.Year    = year;

            movieGroup.Page        = page;
            movieGroup.PagingCount = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(movieGroup.Count) / movieGroup.MovieSize));

            movieGroup.listMovies = movieGroup.listMovies.Skip((page - 1) * movieGroup.MovieSize).Take(movieGroup.MovieSize).ToList();
            if (page > movieGroup.PagingCount && movieGroup.listMovies.Count > 0)
            {
                return(RedirectToAction("NotFound", "Error"));
            }
            string url = Translator.BuildUrl(Request.Url.ToString(), "search", search);

            url = Translator.BuildUrl(url, "genre", genre);
            url = Translator.BuildUrl(url, "country", country);
            url = Translator.BuildUrl(url, "year", year);
            ViewBag.CurrentUrl = url;
            return(View(movieGroup));
        }
        //
        // GET: /Home/Index/
        public ActionResult Index(int offset = 0)
        {
            HomeViewModel             model = new HomeViewModel();
            MR_DataClassesDataContext _db   = new MR_DataClassesDataContext();

            var dis = _db.tbl_Discovery.OrderByDescending(d => d.disc_Flag).ToList();

            if (offset >= dis.Count || offset < 0)
            {
                return(Redirect("/Home/Index?offset=0"));
            }
            model.Discovery        = new HomeDiscViewModel(dis[offset]);
            model.Discovery.Offset = offset;
            model.Discovery.Post   = offset - 1;
            model.Discovery.Pre    = offset + 1;
            if (User.Identity.IsAuthenticated)
            {
                model.Discovery.Movie.IsPlan   = MarkManager.Validate(model.Discovery.Movie.Id, AccountManager.GetId(User.Identity.Name), 1);
                model.Discovery.Movie.IsFinish = MarkManager.Validate(model.Discovery.Movie.Id, AccountManager.GetId(User.Identity.Name), 2);
                model.Discovery.Movie.IsFavor  = MarkManager.Validate(model.Discovery.Movie.Id, AccountManager.GetId(User.Identity.Name), 3);
            }

            var newmovie = _db.tbl_Movie.Where(m => m.movie_Status == 2).OrderByDescending(m => m.movie_Time).ToList().Take(20);

            model.News = new List <MovieListViewModel>();
            foreach (var item in newmovie)
            {
                MovieListViewModel movie = new MovieListViewModel();
                movie.Title = item.movie_Title;
                if (!string.IsNullOrEmpty(item.movie_TitleEn) && !string.IsNullOrWhiteSpace(item.movie_TitleEn))
                {
                    movie.Title += "\t" + item.movie_TitleEn;
                }
                movie.Year = item.movie_Year;
                movie.Id   = item.movie_Id;
                model.News.Add(movie);
            }

            var mostmovie = _db.tbl_Movie.Where(m => m.movie_Status == 2).OrderByDescending(m => m.movie_VisitCount).ToList().Take(20);

            model.Mosts = new List <MovieListViewModel>();
            foreach (var item in mostmovie)
            {
                MovieListViewModel movie = new MovieListViewModel();
                movie.Title = item.movie_Title;
                if (!string.IsNullOrEmpty(item.movie_TitleEn) && !string.IsNullOrWhiteSpace(item.movie_TitleEn))
                {
                    movie.Title += "\t" + item.movie_TitleEn;
                }
                movie.Year = item.movie_Year;
                movie.Id   = item.movie_Id;
                model.Mosts.Add(movie);
            }

            return(View(model));
        }
Exemple #27
0
        /// <summary>
        /// 删除每日发现电影
        /// </summary>
        /// <param name="id">电影id</param>
        public static void Delete(string id)
        {
            using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
            {
                var disc = _db.tbl_Discovery.SingleOrDefault(a => a.disc_Id == id);

                _db.tbl_Discovery.DeleteOnSubmit(disc);
                _db.SubmitChanges();
            }
        }
Exemple #28
0
        /// <summary>
        /// 删除专辑
        /// </summary>
        /// <param name="id">专辑id</param>
        public static void Delete(string id)
        {
            using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
            {
                var album = _db.tbl_Album.SingleOrDefault(a => a.album_Id == id);

                _db.tbl_Album.DeleteOnSubmit(album);
                _db.SubmitChanges();
            }
        }
 /// <summary>
 /// 审核影人不通过
 /// </summary>
 /// <param name="model"></param>
 public static void Reject(RejectViewModel model)
 {
     using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
     {
         tbl_Celebrity celeb = _db.tbl_Celebrity.SingleOrDefault(m => m.celeb_Id == model.Id);
         celeb.celeb_Status = 1;
         celeb.celeb_Note   = model.Note;
         _db.SubmitChanges();
     }
 }
        /// <summary>
        /// 审核影人通过
        /// </summary>
        /// <param name="id">影人id</param>
        public static void Audit(string id)
        {
            using (MR_DataClassesDataContext _db = new MR_DataClassesDataContext())
            {
                tbl_Celebrity celeb = _db.tbl_Celebrity.SingleOrDefault(m => m.celeb_Id == id);
                celeb.celeb_Status = 2;

                _db.SubmitChanges();
            }
        }