Exemple #1
0
        public ActionResult Edit([Bind(Include = "Id,SiteTitle,SiteDesc,HeaderTitle,HeaderDescription,CTA1_Title,CTA1_Description,CTA2_Title,CTA2_Button,Address,Email,Phone")] General general, HttpPostedFileBase LogoImage)
        {
            if (LogoImage != null && LogoImage.ContentLength != 0)
            {
                var path     = Server.MapPath("/Content/");
                var filename = LogoImage.FileName; //resim.jpg
                LogoImage.SaveAs(path + filename);
                general.LogoURL = LogoImage.FileName;
            }
            else
            {
                //resim seçilmediyse eski resim kalsın
                var kayit = db.General.FirstOrDefault();
                general.LogoURL       = kayit.LogoURL;
                db.Entry(kayit).State = EntityState.Detached;
            }

            if (ModelState.IsValid)
            {
                db.Entry(general).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(general));
        }
Exemple #2
0
 public ActionResult Edit([Bind(Include = "Id,Name,Phone,Email,Message,Date")] Contact contact)
 {
     if (ModelState.IsValid)
     {
         db.Entry(contact).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(contact));
 }
 public ActionResult Edit([Bind(Include = "Id,Name")] WorkCategory workCategory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(workCategory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(workCategory));
 }
Exemple #4
0
 public ActionResult Edit([Bind(Include = "Id,ImageURL,Title,ShortDesc,LongDesc")] Work work)
 {
     if (ModelState.IsValid)
     {
         db.Entry(work).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(work));
 }
 public ActionResult Edit([Bind(Include = "Id,LogoURL,SiteTitle,SiteDesc,HeaderTitle,HeaderDescription,CTA1_Title,CTA1_Description,CTA2_Title,CTA2_Button,Address,Email,Phone")] General general)
 {
     if (ModelState.IsValid)
     {
         db.Entry(general).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(general));
 }
Exemple #6
0
 public ActionResult Edit([Bind(Include = "Id,Title,Description,ImageURL")] WhatWeDo whatWeDo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(whatWeDo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(whatWeDo));
 }
Exemple #7
0
 public ActionResult Edit([Bind(Include = "Id,ImageURL,Title,ShortDesc,LongDesc")] Work work, HttpPostedFileBase WorkImage)
 {
     if (WorkImage != null && WorkImage.ContentLength != 0)
     {
         var path     = Server.MapPath("Content/Work/");
         var filename = WorkImage.FileName;
         WorkImage.SaveAs(path + filename);
         work.ImageURL = filename;
     }
     else
     {
         var record = db.Works.FirstOrDefault();
         work.ImageURL          = record.ImageURL;
         db.Entry(record).State = EntityState.Detached;
     }
     if (ModelState.IsValid)
     {
         db.Entry(work).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(work));
 }