Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            AnnouncementItems announcementItems = db.AnnouncementItems.Find(id);

            db.AnnouncementItems.Remove(announcementItems);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 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));
 }
Ejemplo n.º 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();
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 9
0
        public async Task <bool> SaveAnnouncementItemAsync(AnnouncementItems announcement)
        {
            bool success = await announcementItemsRestClient.PostAsync(announcement);

            return(success);
        }