コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            AnnouncementItems announcementItems = db.AnnouncementItems.Find(id);

            db.AnnouncementItems.Remove(announcementItems);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 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));
 }
コード例 #3
0
        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();
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        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));
        }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
        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));
        }
コード例 #8
0
        // 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));
        }
コード例 #9
0
        public async Task <bool> SaveAnnouncementItemAsync(AnnouncementItems announcement)
        {
            bool success = await announcementItemsRestClient.PostAsync(announcement);

            return(success);
        }