public ActionResult DeleteConfirmed(int id) { AnnouncementItems announcementItems = db.AnnouncementItems.Find(id); db.AnnouncementItems.Remove(announcementItems); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,EmailId,Title,Description")] AnnouncementItems announcementItems) { if (ModelState.IsValid) { db.Entry(announcementItems).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(announcementItems)); }
public async void AddAnnouncementButtonClickedAsync(object sender, EventArgs e) { BindingContext = new AnnouncementItems(); var announcementsDetails = (AnnouncementItems)BindingContext; announcementsDetails.Title = AnnouncementsTitle.Text; announcementsDetails.Description = AnnouncementsDescription.Text; await App.Database.SaveAnnouncementItemAsync(announcementsDetails); await Navigation.PopAsync(); }
public ActionResult Create([Bind(Include = "Id,EmailId,Title,Description")] AnnouncementItems announcementItems) { if (ModelState.IsValid) { db.AnnouncementItems.Add(announcementItems); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(announcementItems)); }
public IHttpActionResult PostAnnouncementItems(AnnouncementItems announcementItems) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.AnnouncementItems.Add(announcementItems); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = announcementItems.Id }, announcementItems)); }
private bool AnnouncementItemsExists(string title) { AnnouncementItems announcementItems = db.AnnouncementItems.Where(c => c.Title == title).FirstOrDefaultAsync <AnnouncementItems>().Result; if (announcementItems == null) { return(false); } else { return(true); } }
public IHttpActionResult DeleteAnnouncementItems(string title) { AnnouncementItems announcementItems = db.AnnouncementItems.Where(c => c.Title == title).FirstOrDefaultAsync <AnnouncementItems>().Result; if (announcementItems == null) { return(NotFound()); } db.AnnouncementItems.Remove(announcementItems); db.SaveChanges(); return(Ok(announcementItems)); }
// GET: AnnouncementItemsMVC/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AnnouncementItems announcementItems = db.AnnouncementItems.Find(id); if (announcementItems == null) { return(HttpNotFound()); } return(View(announcementItems)); }
public async Task <bool> SaveAnnouncementItemAsync(AnnouncementItems announcement) { bool success = await announcementItemsRestClient.PostAsync(announcement); return(success); }