Esempio n. 1
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Date,Address,Description")] Concert concert, HttpPostedFileBase thumbnail)
        {
            db.Entry(concert).State = EntityState.Modified;
            if (thumbnail != null)
            {
                concert.Thumbnail = Thumbnail.Create(thumbnail);
            }
            else
            {
                db.Entry(concert).Property(x => x.Thumbnail).IsModified = false;
            }
            if (ModelState.IsValid)
            {
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            if (Request.IsAjaxRequest())
            {
                return(PartialView(concert));
            }
            return(View(concert));
        }
Esempio n. 2
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Date,Title,Abstract,Text")] News news, HttpPostedFileBase thumbnail)
        {
            db.Entry(news).State = EntityState.Modified;
            if (thumbnail != null)
            {
                news.Thumbnail = Thumbnail.Create(thumbnail);
            }
            else
            {
                db.Entry(news).Property(x => x.Thumbnail).IsModified = false;
            }
            if (ModelState.IsValid)
            {
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            if (Request.IsAjaxRequest())
            {
                return(PartialView(news));
            }
            return(View(news));
        }