Exemplo n.º 1
0
        //[Authorize(Roles = "Manager")]
        public ActionResult Edit(tbl_platter platter, HttpPostedFileBase image1)
        {
            if (ModelState.IsValid)
            {
                //if (Session["scode"] != null)
                //{
                //    Session["scode"].ToString();
                //}
                if (image1 != null)
                {
                    platter.platter_image = new byte[image1.ContentLength];
                    image1.InputStream.Read(platter.platter_image, 0, image1.ContentLength);
                }

                db.Entry(platter).State = System.Data.Entity.EntityState.Modified;

                db.SaveChanges();
                return(RedirectToAction("Index", new { code = platter.secret_code }));
            }
            return(View());
        }
Exemplo n.º 2
0
        public ActionResult UpdateComment(Rating_tbl reviewmodel)
        {
            if (Session["User_id"] != null && Session["User_name"] != null)
            {
                Session["User_id"].ToString();
                Session["User_name"].ToString();
            }

            reviewmodel.Time            = DateTime.Now;
            db.Entry(reviewmodel).State = System.Data.Entity.EntityState.Modified;

            var totalrate = (from p in db.tbl_platter
                             where (p.platter_id == reviewmodel.Platter_id)
                             select p).FirstOrDefault();


            totalrate.rating_total = totalrate.rating_total + reviewmodel.Rate;
            totalrate.rating_count++;

            db.SaveChanges();
            return(RedirectToAction("Index", "Home"));
        }