Update() public method

public Update ( ) : void
return void
Esempio n. 1
0
        public ActionResult StatusActiveAndPassive(int id)
        {
            var aboutValue = aboutManager.GetById(id);

            if (aboutValue.AboutStatus == true)
            {
                aboutValue.AboutStatus = false;
            }
            else
            {
                aboutValue.AboutStatus = true;
            }
            aboutManager.Update(aboutValue);
            return(RedirectToAction("Index"));
        }
 public ActionResult About(Hakkimizda model)
 {
     if (ModelState.IsValid)
     {
         Hakkimizda hak = AboutManager.ListQueryable().FirstOrDefault();
         if (hak != null)
         {
             hak.Aciklama = model.Aciklama;
             if (AboutManager.Update(hak) > 0)
             {
                 TempData["isEdited"] = true;
                 return(RedirectToAction("Index"));
             }
         }
         TempData["isEdited"] = false;
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
 public ActionResult Edit(About about, HttpPostedFileBase Image)
 {
     if (ModelState.IsValid)
     {
         About a = aboutManager.Find(x => x.Id == about.Id);
         if (Image != null &&
             (Image.ContentType == "image/jpeg" ||
              Image.ContentType == "image/jpg" ||
              Image.ContentType == "image/png"))
         {
             string filename = $"user_{about.Id}.{Image.ContentType.Split('/')[1]}";
             Image.SaveAs(Server.MapPath($"~/Image/user/{filename}"));
             a.Image = filename;
         }
         a.Text = about.Text;
         aboutManager.Update(a);
         return(RedirectToAction("Index"));
     }
     return(View(about));
 }
Esempio n. 4
0
        public ActionResult AboutEdit(About about, HttpPostedFileBase file)
        {
            var aboutDetail = aboutManager.Find(a => a.Id == about.Id);

            aboutDetail.Description = about.Description;

            if (file != null)
            {
                if (file.ContentLength > 0)
                {
                    char   ayrac     = '.';
                    string extension = Path.GetExtension(file.FileName);
                    string _path     = Path.Combine(Server.MapPath("~/Content/Images/"), file.FileName.Split(ayrac)[0] + extension);
                    file.SaveAs(_path);
                    aboutDetail.ImageUrl = _path;
                }
            }

            aboutManager.Update(aboutDetail);
            return(RedirectToAction("About"));
        }