public ActionResult newanouncement(Anouncements model) { if (ModelState.IsValid) { db.Anouncements.Add(model); db.SaveChanges(); TempData["Success"] = "Elan əlavə edildi."; return(RedirectToAction("anouncements")); } return(RedirectToAction("anouncements")); }
public ActionResult editanouncement(Anouncements model) { if (ModelState.IsValid) { var mymodel = db.Anouncements.Find(model.Id); mymodel.AnounceName = model.AnounceName; mymodel.AnounceDescription = model.AnounceDescription; mymodel.AnounceDate = model.AnounceDate; mymodel.ShareWith = model.ShareWith; db.SaveChanges(); TempData["SuccessEdit"] = "Düzəliş edildi."; return(RedirectToAction("anouncements")); } return(HttpNotFound()); }