示例#1
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);
            }
        }
示例#2
0
        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;
        }
 public ManageDiscViewModel(tbl_Discovery model)
 {
     Id         = model.disc_Id;
     Movie      = model.disc_Movie;
     MovieTitle = MovieManager.GetTitle(model.disc_Movie);
     Image      = model.disc_Image;
     Flag       = model.disc_Flag;
     Time       = model.disc_Time.ToString();
 }