Beispiel #1
0
        // GET: Home
        public ActionResult Index(string id, string name, string title)
        {
            ViewBag.ID = id;
            List <Models.Album> list = new List <Models.Album>();


            var item = new Models.Album();

            item.Genre = "pop";
            item.Title = "The Best Of The Men At Work";
            item.Price = 8;

            list.Add(item);

            var item2 = new Models.Album();

            item2.Genre = "Metal";
            item2.Title = "Black Light Syndrome";
            item2.Price = 20;
            list.Add(item2);
            ViewBag.ListDatas = list;

            return(View());
            //return Content("<h1>hello world</h1>" + id);
        }
Beispiel #2
0
        public ActionResult timetable(string id)
        {
            Models.Album        item = null;
            Service.DataService data = new Service.DataService();
            var list = data.LoadAllAlbum();

            item = list.SingleOrDefault(x => x.ID == id);
            return(View(item));
        }
        public void InitialAndCreatCart(Models.Album album, string shoppingCartId)
        {
            // Create a new cart item if no cart item exists
            var cartItem = new Cart()
            {
                AlbumId     = album.AlbumId,
                CartId      = shoppingCartId,
                Count       = 1,
                DateCreated = DateTime.Now
            };

            storeDB.Carts.Add(cartItem);
            storeDB.SaveChanges();
        }
Beispiel #4
0
        //
        // GET: /Fotos/Album/

        public ActionResult Album(string id)
        {
            Models.Album album = Models.Album.obtenerAlbum(id);

            if (album == null || string.IsNullOrEmpty(album.id))
            {
                return(RedirectTo(Pagina.ERROR, 404));
            }

            ViewBag.fotos              = Foto.obtenerFotosDeAlbum(id);
            ViewBag.albumes            = Models.Album.obtenerAlbumsDeOlimpiada(album.olimpiada, album.tipoOlimpiada);
            ViewBag.olimpiadas         = Olimpiada.obtenerOlimpiadas(album.tipoOlimpiada);
            ViewBag.olimpiadasConFotos = Models.Album.obtenerOlimpiadasConAlbumes(album.tipoOlimpiada);

            return(View(album));
        }
Beispiel #5
0
        public List <Models.Album> LoadAllAlbum()
        {
            List <Models.Album> list = new List <Models.Album>();


            var item = new Models.Album();

            item.Genre = "pop";
            item.Title = "The Best Of The Men At Work";
            item.Price = 8;

            list.Add(item);

            var item2 = new Models.Album();

            item2.Genre = "Metal";
            item2.Title = "Black Light Syndrome";
            item2.Price = 20;
            list.Add(item2);
            return(list);
        }
Beispiel #6
0
        public List <Models.Album> LoadAllAlbum()
        {
            List <Models.Album> list = new List <Models.Album>();


            var item = new Models.Album();

            item.image  = "https://media2.popsugar-assets.com/files/2016/02/08/898/n/1922398/4c2124bfd07afeca_heart-shaped-pizza-2016.xxxlarge_2x.jpg";
            item.name   = "蔡松霖";
            item.number = 1103105329;
            item.link   = "課表";
            list.Add(item);

            var item2 = new Models.Album();

            item2.image  = "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQ3Bdu409rOMbmEKqHneDWkj-UuKVkM82SFAkDYG6zHNjwpqe-C";
            item2.name   = "黃柏翔";
            item2.number = 1103105321;
            item2.link   = "課表";
            list.Add(item2);

            var item3 = new Models.Album();

            item3.image  = "http://images.vectorhq.com/images/previews/cc6/domo-kun-psd-454972.png";
            item3.name   = "謝翔羽";
            item3.number = 1103105313;
            item3.link   = "可愛的課表";
            list.Add(item3);

            var item4 = new Models.Album();

            item4.image  = "http://www.geeky-gadgets.com/wp-content/uploads/2010/06/android-robot1.jpg";
            item4.name   = "蔡承翰";
            item4.number = 1103105312;
            item4.link   = "課表";
            list.Add(item4);

            return(list);
        }
Beispiel #7
0
        public List <Models.Album> LoadAllAlbum()
        {
            List <Models.Album> list = new List <Models.Album>();


            var item = new Models.Album();

            item.Genre = "1103105306";
            item.Title = "劉郁心";
            item.Price = 8;

            list.Add(item);

            var item2 = new Models.Album();

            item2.Genre = "1103105322";
            item2.Title = "陳怡君";
            item2.Price = 20;
            list.Add(item2);

            var item3 = new Models.Album();

            item3.Genre = "1103105327";
            item3.Title = "李偲瑋";
            item3.Price = 20;
            list.Add(item3);

            var item4 = new Models.Album();

            item4.Genre = "1103105344";
            item4.Title = "林佑宗";
            item4.Price = 20;
            list.Add(item4);

            return(list);
        }
Beispiel #8
0
        public static Album FromDBObject(Models.Album album, Models.mediadbContext dbContext)
        {
            var artist = Artist.FromDBObject(dbContext.Artist.Where(a => a.Name == album.ArtistName).First());

            return(new Album(album.Name, album.Title, artist));
        }
        // GET: Home
        public ActionResult Index(string id, string name, string title)
        {
            ViewBag.ID = id;
            List <Models.Album> list = new List <Models.Album>();


            var item = new Models.Album();

            item.Name          = "廖華聖";
            item.Number        = "1103105305";
            item.Say           = "將軍,字面意思就是率領軍隊。夏商周時期,天子統率的部隊分為六軍,每軍約一萬二千五百人。到了春秋時期,諸侯制大國三軍、次國二軍、小國一軍,晉國魏獻子自己統領一支軍隊,稱「將軍」。";
            item.Picture       = "/picture/1.jpg";
            item.facebook_link = "https://www.facebook.com/profile.php?id=100002570302312";
            list.Add(item);

            var item2 = new Models.Album();

            item2.Name          = "林佑恩";
            item2.Number        = "1103105336";
            item2.Say           = "先別管這些了,你有聽過安麗嗎?";
            item2.Picture       = "/picture/2.jpg";
            item2.facebook_link = "https://www.facebook.com/profile.php?id=100002288875969";
            list.Add(item2);

            var item3 = new Models.Album();

            item3.Name          = "陳政穎";
            item3.Number        = "1103105342";
            item3.Say           = "長頸鹿的熱咖啡,在流到他的喉嚨的時候,熱咖啡早就冷掉了。 你有想過這個嗎? 沒有!!!因為你只會想到你自己";
            item3.Picture       = "/picture/3.jpg";
            item3.facebook_link = "https://www.facebook.com/zing.chen.5";
            list.Add(item3);

            var item4 = new Models.Album();

            item4.Name          = "林敬宗";
            item4.Number        = "1103105310";
            item4.Say           = "天下無奇不有,連「牛糞」也有人要偷!英國懷特島(Isle of Wight)動物園內的「國家大便博物館」(The National Poo Museum)發生竊案,準備在巡迴展覽中展示的「牛糞」竟不翼而飛,連館方都猜想不到竊賊的動機是什麼。";
            item4.Picture       = "/picture/4.jpg";
            item4.facebook_link = "https://www.facebook.com/profile.php?id=100000449332604";
            list.Add(item4);

            var item5 = new Models.Album();

            item5.Name          = "許庭章";
            item5.Number        = "1103105331";
            item5.Say           = "大包小包準備滾回高雄。繼續吃喝玩樂嘻嘻哈哈。當然最重要的是認真讀書😏😏😏 #連假尾聲#再見我的家鄉 #高雄我來了#大三新生活 #我是老屁股#快樂讀書趣";
            item5.Picture       = "/picture/5.jpg";
            item5.facebook_link = "https://www.facebook.com/tingchang.hsu";
            list.Add(item5);

            var item6 = new Models.Album();

            item6.Name          = "李淑燕";
            item6.Number        = "1103105382";
            item6.Picture       = "/picture/6.jpg";
            item6.facebook_link = "https://www.facebook.com/shuyan.li.3";
            list.Add(item6);

            var item7 = new Models.Album();

            item7.Name    = "連結";
            item7.Number  = "07";
            item7.Picture = "";
            list.Add(item7);

            var item8 = new Models.Album();

            item8.Name    = "相片集";
            item8.Number  = "08";
            item8.Picture = "";
            list.Add(item8);

            ViewBag.ListDatas = list;

            return(View());
            //return Content("<h1>hello world</h1>" + id);
        }
 public void EditAlbum(Models.Album album)
 {
     storeDB.Entry(album).State = EntityState.Modified;
     storeDB.SaveChanges();
 }
Beispiel #11
0
 public void Delete(Models.Album obj)
 {
     throw new NotImplementedException();
 }
Beispiel #12
0
        static DataService()
        {
            var item = new Models.Album();

            item.學號       = "1103105352";
            item.姓名       = "黃俊木";
            item.班級       = "四子三丙";
            item.星座       = "天秤座";
            item.生日       = "1996/9/27";
            item.facebook = "https://www.facebook.com/profile.php?id=100000383148753&fref=ts";
            //item.Genre = 8;

            list.Add(item);

            var item2 = new Models.Album();

            item2.學號       = "1103105311";
            item2.姓名       = "李思毅";
            item2.班級       = "四子三丙";
            item2.星座       = "水瓶座";
            item2.生日       = "1996/1/23";
            item2.facebook = "https://www.facebook.com/profile.php?id=100002678443071&fref=ts";
            //item2.Genre = 8; ;
            list.Add(item2);



            var item3 = new Models.Album();

            item3.學號       = "1103105302";
            item3.姓名       = "張根維";
            item3.班級       = "四子三丙";
            item3.星座       = "雙魚座";
            item3.生日       = "1996/2/27";
            item3.facebook = "https://www.facebook.com/profile.php?id=100002759816060&fref=ts";
            //item3.Genre = 8; ;
            list.Add(item3);



            var item4 = new Models.Album();

            item4.學號       = "1103105339";
            item4.姓名       = "曾文輝";
            item4.班級       = "四子三丙";
            item4.星座       = "射手座";
            item4.生日       = "1995/11/27";
            item4.facebook = "https://www.facebook.com/profile.php?id=100000800300304&fref=ts";
            //item4.Genre = 8; ;
            list.Add(item4);

            var item5 = new Models.Album();

            item5.學號       = "1103105342";
            item5.姓名       = "姚呈政";
            item5.班級       = "四子三丙";
            item5.星座       = "魔羯座";
            item5.生日       = "1995/12/28";
            item5.facebook = "https://www.facebook.com/yao.dong.54?fref=ts";
            //item4.Genre = 8; ;
            list.Add(item5);


            //var table1= new Models.Album();
            //table1.one = "4564 ";
            //table1.two = " ";
            //table1.three = " ";
            //table1.four = " ";
            //table1.five = " ";
            ////table1.six = " ";
            ////table1.seven = " ";
            ////table1.eight = " ";
            ////table1.nine = "行動平台";
            ////table1.ten = "行動平台";
            ////table1.eleven = "行動平台";
            ////table1.twelve = "行動平台";
            //list.Add(table1);

            //var table2 = new Models.Album();
            //table2.one = " ";
            //table2.two = "1 ";
            //table2.three = " ";
            //table2.four = "1 ";
            //table2.five= " ";
            //list.Add(table2);

            //var table3 = new Models.Album();
            //table3.one = " ";
            //table3.two = " 1";
            //table3.three = "1 ";
            //table3.four = " 1";
            //table3.five= " ";
            //list.Add(table3);

            //var table4 = new Models.Album();
            //table4.one = " 1";
            //table4.two= " 1";
            //table4.three = " ";
            //table4.four= " ";
            //table4.five= " ";
            //list.Add(table4);

            //var table5 = new Models.Album();
            //table5.one = " ";
            //table5.two= " ";
            //table5.three = " ";
            //table5.four= " ";
            //table5.five= " 1";
            //list.Add(table5);
        }
Beispiel #13
0
        static DataService()
        {
            var item = new Models.Album();

            item.ID            = "1103105308";
            item.name          = "巫孟哲";
            item.Class         = "四子三丙";
            item.Constellation = "魔羯座";
            item.birthday      = "1995/1/17";
            //item.Genre = 8;

            list.Add(item);

            var item2 = new Models.Album();

            item2.ID            = "1103105337";
            item2.name          = "鄭義文";
            item2.Class         = "四子三丙";
            item2.Constellation = "牡羊座";
            item2.birthday      = "1996/4/2";
            //item2.Genre = 8; ;
            list.Add(item2);



            var item3 = new Models.Album();

            item3.ID            = "1103105348";
            item3.name          = "石承民";
            item3.Class         = "四子三丙";
            item3.Constellation = "巨蟹座";
            item3.birthday      = "1996/7/13";
            //item3.Genre = 8; ;
            list.Add(item3);



            var item4 = new Models.Album();

            item4.ID            = "1103105382";
            item4.name          = "陳伯嘉";
            item4.Class         = "四子三丙";
            item4.Constellation = "XX座";
            item4.birthday      = "查無此人";
            //item4.Genre = 8; ;
            list.Add(item4);



            //var table1= new Models.Album();
            //table1.one = "4564 ";
            //table1.two = " ";
            //table1.three = " ";
            //table1.four = " ";
            //table1.five = " ";
            ////table1.six = " ";
            ////table1.seven = " ";
            ////table1.eight = " ";
            ////table1.nine = "行動平台";
            ////table1.ten = "行動平台";
            ////table1.eleven = "行動平台";
            ////table1.twelve = "行動平台";
            //list.Add(table1);

            //var table2 = new Models.Album();
            //table2.one = " ";
            //table2.two = "1 ";
            //table2.three = " ";
            //table2.four = "1 ";
            //table2.five= " ";
            //list.Add(table2);

            //var table3 = new Models.Album();
            //table3.one = " ";
            //table3.two = " 1";
            //table3.three = "1 ";
            //table3.four = " 1";
            //table3.five= " ";
            //list.Add(table3);

            //var table4 = new Models.Album();
            //table4.one = " 1";
            //table4.two= " 1";
            //table4.three = " ";
            //table4.four= " ";
            //table4.five= " ";
            //list.Add(table4);

            //var table5 = new Models.Album();
            //table5.one = " ";
            //table5.two= " ";
            //table5.three = " ";
            //table5.four= " ";
            //table5.five= " 1";
            //list.Add(table5);
        }
Beispiel #14
0
        public IActionResult CreateAlbum(ICollection <Microsoft.AspNet.Http.IFormFile> Productphoto_file, Album model)
        {
            try
            {
                //  ResultBundle result = ResultBundle.Failed();
                if (ModelState.IsValid)
                {
                    if (Productphoto_file.Count > 0)
                    {
                        foreach (var file in Productphoto_file)
                        {
                            if (file.Length > 1024 * 1024)
                            {
                                TempData["ErrorMessage"] = "حجم فایل انتخاب شده بیش از یک مگابایت است. لطفا فایل دیگری انتخاب نمایید";
                                break;
                            }
                            else if (file.Length == 0)
                            {
                                TempData["ErrorMessage"] = "حجم فایل انتخاب شده صفر بایت است. لطفا فایل دیگری انتخاب نمایید";
                                break;
                            }
                            else
                            {
                                var fileName = Microsoft.Net.Http.Headers.ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"');


                                using (Stream sr = file.OpenReadStream())
                                {
                                    byte[] fileData = null;
                                    using (MemoryStream msOrig = Utils.LoadToMemoryStream(sr))
                                    {
                                        // resize it
                                        // todo: we always resize profile image to 600x500
                                        Image img = Bitmap.FromStream(msOrig);
                                        // Bitmap bmp = new Bitmap(img, new Size(600, 500));

                                        Bitmap       bmp = new Bitmap(img, new Size(340, 280));
                                        MemoryStream ms  = new MemoryStream();
                                        bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);



                                        // read content instead
                                        fileData = Utils.ConvertMemoryStreamToBytes(ms);

                                        ms.Dispose();
                                        bmp.Dispose();
                                        img.Dispose();
                                    }


                                    // _db = new DALContext();
                                    Models.Album Album = new Models.Album();
                                    Album.AssetData = new Byte[fileData.Length];
                                    Album.AssetType = "jpg";
                                    Buffer.BlockCopy(fileData, 0, Album.AssetData, 0, fileData.Length);
                                    //imgc.Id = 2;
                                    ViewBag.imgusedatabaseController = Album.AssetData;//for img usedatabaseController
                                    Album.Titel = model.Titel;
                                    _db.Albums.Add(Album);
                                    _db.SaveChanges();
                                    TempData["ErrorMessage"] = ("درج با موفقیت انجام شد");
                                }
                            }
                        }
                    }
                    else
                    {
                        TempData["ErrorMessage"] = ("لطفا یک عکس انتخاب نمایید ");
                        // result.AddMessage("لطفا یک عکس انتخاب نمایید ");
                    }
                }
                else
                {
                    TempData["ErrorMessage"] = ("لطفا یک عکس انتخاب کنید و عنوان را وارد نمایید ");
                    // result.AddMessage("لطفا یک عکس انتخاب کنید و عنوان را وارد نمایید ");
                }
                //  ViewBag.errorMessage = result.FormattedMessages;
                return(View());
            }
            catch (Exception ex)
            {
                return(RedirectToAction(nameof(HomeController.Error), "Home"));
            }
        }
Beispiel #15
0
        public IActionResult Edit(ICollection <Microsoft.AspNet.Http.IFormFile> Productphoto_file, Album model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (Productphoto_file.Count > 0)
                    {
                        foreach (var file in Productphoto_file)
                        {
                            if (file.Length > 1024 * 1024)
                            {
                                TempData["ErrorMessage"] = "حجم فایل انتخاب شده بیش از یک مگابایت است. لطفا فایل دیگری انتخاب نمایید";

                                break;
                            }
                            else if (file.Length == 0)
                            {
                                TempData["ErrorMessage"] = "حجم فایل انتخاب شده صفر بایت است. لطفا فایل دیگری انتخاب نمایید";

                                break;
                            }
                            else
                            {
                                var fileName = Microsoft.Net.Http.Headers.ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"');

                                using (Stream sr = file.OpenReadStream())
                                {
                                    byte[] fileData = null;
                                    using (MemoryStream msOrig = Utils.LoadToMemoryStream(sr))
                                    {
                                        // resize it
                                        // todo: we always resize profile image to 140x140
                                        Image        img = Bitmap.FromStream(msOrig);
                                        Bitmap       bmp = new Bitmap(img, new Size(340, 280));
                                        MemoryStream ms  = new MemoryStream();
                                        bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);



                                        // read content instead
                                        fileData = Utils.ConvertMemoryStreamToBytes(ms);

                                        ms.Dispose();
                                        bmp.Dispose();
                                        img.Dispose();
                                    }

                                    /*
                                     * // remove error flags
                                     * //TempData.Remove("ErrorMessage");
                                     * AssetData = new Byte[fileData.Length];
                                     *
                                     * AssetType= "jpg";
                                     * Buffer.BlockCopy(fileData, 0, AssetData, 0, fileData.Length);
                                     *
                                     *
                                     * ViewBag.up = Utils.GenerateHttpResponseImageOntheFly(AssetData, "jpg");
                                     *
                                     * // just one file!
                                     * // break;
                                     */

                                    //_db = new DALContext();
                                    Models.Album Album = new Models.Album();
                                    Album.AssetData = new Byte[fileData.Length];
                                    Album.AssetType = "jpg";
                                    Buffer.BlockCopy(fileData, 0, Album.AssetData, 0, fileData.Length);

                                    ViewBag.imgusedatabaseController = Album.AssetData;//for img usedatabaseController

                                    Album.Titel = model.Titel;

                                    Album.Id = model.Id;
                                    _db.Entry(Album).State = Microsoft.Data.Entity.EntityState.Modified;
                                    _db.SaveChanges();

                                    TempData["ErrorMessage"] = " ویرایش انجام شد";
                                }
                            }
                        }
                    }
                    else
                    {
                        //_db = new DALContext();
                        Models.Album a = _db.Albums.FirstOrDefault(x => x.Id == model.Id);


                        a.Titel = model.Titel;
                        _db.SaveChanges();
                        TempData["ErrorMessage"] = "ویرایش انجام شد";
                    }
                }
                else
                {
                    TempData["ErrorMessage"] = "لطفا یک عکس انتخاب کنید و عنوان را وارد نمایید ";
                }

                //return RedirectToAction("ShowAlbums");
                //return View();
                return(RedirectToAction("Edit", model.Id));
            }
            catch (Exception ex)
            {
                return(RedirectToAction(nameof(HomeController.Error), "Home"));
            }
        }
Beispiel #16
0
 public object Save(Models.Album obj)
 {
     throw new NotImplementedException();
 }
Beispiel #17
0
        public void SaveAlbum(Zirpl.Spotify.MetadataApi.Album album, Zirpl.Spotify.MetadataApi.Artist artist)
        {
            var result = new SpotifyMetadataApiClient().LookupAlbum(album.Href);

            MusicApp.Models.Album a = new Models.Album();
            a.Name = result.Name;
            a.Href = album.Href;
            a.ArtistId = artist.Href;
            a.Popularity = album.Popularity;
            a.Artist = result.Artist;
            a.Released = result.Released;

            var songs = from s in db.Songs
                        select s;
            songs = songs.Where(s => s.AlbumID.Contains(album.Href));

            if (songs.Count() > 0)
            {
                var maxObject = songs.OrderByDescending(item => item.Length).First();
                a.LengthLongest = maxObject.Length;
                a.NameLongest = maxObject.Name;
            }

            //if (ModelState.IsValid)
            if (result.Artist == artist.Name)
            {
                db.Albums.Add(a);
            }
        }
Beispiel #18
0
 public ActionResult Edit(Models.Album album)
 {
     return(RedirectToAction("Index"));
 }
 public void CreateAlbum(Models.Album album)
 {
     storeDB.Albums.Add(album);
     storeDB.SaveChanges();
 }