예제 #1
0
 public ActionResult ShowAlbums()
 {
     using (var db = new ReviewerContext())
     {
         return View(db.Album.ToList());
     }
 }
예제 #2
0
 public ActionResult Index()
 {
     ViewBag.Message = "Reviews List";
     var db = new ReviewerContext();
     IEnumerable<Review> model = db.Review;
     return View(model);
 }
예제 #3
0
        public ActionResult AddNewAlbum(Album data, HttpPostedFileBase image)
        {
            using (var db = new ReviewerContext())

            {
                if (image != null)
                {
                    var binaryReader = new BinaryReader(image.InputStream);

                    var img = new Cover();
                    img.Image = binaryReader.ReadBytes(image.ContentLength);

                    img.Name = image.ContentType;
                    db.Cover.Add(img);
                }
                else
                {
                    var img = new Cover();
                    img.Image = null;
                    img.Name = null;
                    db.Cover.Add(img);
                }

                db.Album.Add(data);
                db.SaveChanges();
            }
            return View();
        }
예제 #4
0
 public ActionResult Index()
 {
     using(var db = new ReviewerContext())
     {
         return View(db.Review.ToList());
     }
 }
예제 #5
0
        public ActionResult AddNewReview(Review review)
        {
            if (review.ProfileId == 0)
            {
                review.ProfileId = 1;
            }
            var db = new ReviewerContext();
            db.Review.Add(review);
            db.SaveChanges();

            return View();
        }
예제 #6
0
 public FileContentResult GetImage(int coverId)
 {
     var db = new ReviewerContext();
     Cover cover = db.Cover.FirstOrDefault(p => p.Id == coverId);
     if (cover != null)
     {
         return new FileContentResult(cover.Image, cover.Name);
     }
     else
     {
         return null; //we need to implement default image with "NO COVER YET" or sth like that.
     }
 }