public ActionResult Update(SettingSocial settingSocial) { SettingSocial SettingSocial = db.SettingSocials.Find(settingSocial.Id); if (settingSocial.SettingId < 1) { ModelState.AddModelError("", "setting is required"); ViewBag.Settings = db.Settings.ToList(); return(View(settingSocial)); } if (ModelState.IsValid) { SettingSocial.Name = settingSocial.Name; SettingSocial.Icon = settingSocial.Icon; SettingSocial.Link = settingSocial.Link; SettingSocial.SettingId = settingSocial.SettingId; db.Entry(SettingSocial).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Settings = db.Settings.ToList(); return(View(SettingSocial)); }
public ActionResult Update(int id) { SettingSocial settingSocial = db.SettingSocials.Find(id); if (settingSocial == null) { return(HttpNotFound()); } ViewBag.Settings = db.Settings.ToList(); return(View(settingSocial)); }
public ActionResult Delete(int id) { SettingSocial settingSocial = db.SettingSocials.Find(id); if (settingSocial == null) { return(HttpNotFound()); } db.SettingSocials.Remove(settingSocial); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(SettingSocial settingSocial) { if (settingSocial.SettingId < 1) { ModelState.AddModelError("", "setting is required"); ViewBag.Settings = db.Settings.ToList(); return(View(settingSocial)); } if (ModelState.IsValid) { db.SettingSocials.Add(settingSocial); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Settings = db.Settings.ToList(); return(View(settingSocial)); }