Esempio n. 1
0
        public ActionResult Edit([Bind(Include = "Id,UserId,Title,Text,Price")] Project project, HttpPostedFileBase File)
        {
            if (ModelState.IsValid)
            {
                db.Entry(project).State = EntityState.Modified;

                if (File != null && File.ContentLength > 0)
                {
                    using (var reader = new System.IO.BinaryReader(File.InputStream))
                    {
                        project.File        = reader.ReadBytes(File.ContentLength);
                        project.FileName    = File.FileName;
                        project.ContentType = File.ContentType;
                    }
                }
                else
                {
                    db.Entry(project).Property("File").IsModified        = false;
                    db.Entry(project).Property("Filename").IsModified    = false;
                    db.Entry(project).Property("ContentType").IsModified = false;
                }

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.UserId = new SelectList(db.UserSet, "Id", "Name", project.UserId);
            return(View(project));
        }
Esempio n. 2
0
        public ActionResult Edit([Bind(Include = "Id,Baslik,Text,YayimTarihi,CategoryId,AuthorId,NewsTypeId")] News news, HttpPostedFileBase ResimYol)
        {
            if (ModelState.IsValid)
            {
                db.Entry(news).State = EntityState.Modified;

                if (ResimYol != null && ResimYol.ContentLength > 0)
                {
                    using (var reader = new System.IO.BinaryReader(ResimYol.InputStream))
                    {
                        news.ResimYol = reader.ReadBytes(ResimYol.ContentLength);
                    }
                }
                else
                {
                    db.Entry(news).Property("ResimYol").IsModified = false;
                }

                db.Entry(news).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.CategoryId = new SelectList(db.CategorySet, "Id", "Adi", news.CategoryId);
            ViewBag.AuthorId   = new SelectList(db.AuthorSet, "Id", "Adi", news.AuthorId);
            ViewBag.NewsTypeId = new SelectList(db.NewsTypeSet, "Id", "Adi", news.NewsTypeId);
            return(View(news));
        }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "Id,Title")] UserType userType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(userType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(userType));
 }
Esempio n. 4
0
 public ActionResult Edit([Bind(Include = "Id,Adi")] Category category)
 {
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(category));
 }
Esempio n. 5
0
 public ActionResult Edit([Bind(Include = "Id,Adi,Soyadi,Telefon,Mail,Foto")] Author author)
 {
     if (ModelState.IsValid)
     {
         db.Entry(author).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(author));
 }
Esempio n. 6
0
 public ActionResult Edit([Bind(Include = "Id,UserId,Amount,Date")] Payment payment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(payment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserId = new SelectList(db.UserSet, "Id", "Name", payment.UserId);
     return(View(payment));
 }
Esempio n. 7
0
 public ActionResult Edit([Bind(Include = "Id,Ozet,Resim,NewsId")] Picture picture)
 {
     if (ModelState.IsValid)
     {
         db.Entry(picture).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.NewsId = new SelectList(db.NewsSet, "Id", "Baslik", picture.NewsId);
     return(View(picture));
 }
Esempio n. 8
0
 public ActionResult Edit([Bind(Include = "Id,Baslik,Text,Date,Verified,UserId,NewsId")] Comment comment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(comment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserId = new SelectList(db.UserSet, "Id", "Name", comment.UserId);
     ViewBag.NewsId = new SelectList(db.NewsSet, "Id", "Baslik", comment.NewsId);
     return(View(comment));
 }
Esempio n. 9
0
 public ActionResult Edit([Bind(Include = "Id,UserId,ProjectId")] ProjectAccess projectAccess)
 {
     if (ModelState.IsValid)
     {
         db.Entry(projectAccess).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserId    = new SelectList(db.UserSet, "Id", "Name", projectAccess.UserId);
     ViewBag.ProjectId = new SelectList(db.ProjectSet, "Id", "Title", projectAccess.ProjectId);
     ViewBag.Id        = new SelectList(db.PaymentSet, "Id", "Amount", projectAccess.Id);
     return(View(projectAccess));
 }
Esempio n. 10
0
        public ActionResult Edit([Bind(Include = "Id,UserTypeId,Name,Mail,Password")] User user, HttpPostedFileBase Avatar)
        {
            if (ModelState.IsValid)
            {
                db.Entry(user).State = EntityState.Modified;

                if (Avatar != null && Avatar.ContentLength > 0)
                {
                    using (var reader = new System.IO.BinaryReader(Avatar.InputStream))
                    {
                        user.Avatar = reader.ReadBytes(Avatar.ContentLength);
                    }
                }
                else
                {
                    db.Entry(user).Property("Avatar").IsModified = false;
                }

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.UserTypeId = new SelectList(db.UserTypeSet, "Id", "Title", user.UserTypeId);
            return(View(user));
        }