Exemple #1
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }
            FakeNews b = _viewService.ViewNews(id);

            if (b == null)
            {
                return(HttpNotFound());
            }
            return(View(b));
        }
Exemple #2
0
        public ActionResult DeleteConfirmed(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }
            FakeNews fakeNews = _viewService.ViewNews(id);

            if (fakeNews == null)
            {
                return(HttpNotFound());
            }
            _viewService.Delete(fakeNews);
            return(RedirectToAction("Index"));
        }
 private void ClientModelChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName.Equals("Connected"))
     {
         NotifyPropertyChanged("Connected");
         ConnectCommand.RaiseCanExecuteChanged();
         SendCommand.RaiseCanExecuteChanged();
         China2.RaiseCanExecuteChanged();
         BingBong.RaiseCanExecuteChanged();
         Wrong.RaiseCanExecuteChanged();
         GreatWall.RaiseCanExecuteChanged();
         ReallyRich.RaiseCanExecuteChanged();
         FakeNews.RaiseCanExecuteChanged();
         BuildWall.RaiseCanExecuteChanged();
     }
     else if (e.PropertyName.Equals("MessageBoard"))
     {
         NotifyPropertyChanged("MessageBoard");
     }
 }
Exemple #4
0
        public int Create(FakeNewsViewModel model, string path)
        {
            if (model.ImgFile != null)
            {
                string fileName = System.IO.Path.GetFileName(model.ImgFile.FileName);
                model.ImgFile.SaveAs(path + fileName);
                model.Image = fileName;
            }
            var fakeNews = new FakeNews()
            {
                Name       = model.Name,
                Text       = model.Text,
                Date       = DateTime.Now,
                CategoryId = model.CategoryId,
                Image      = model.Image
            };

            db.FakeNews.Add(fakeNews);
            db.SaveChanges();
            return(fakeNews.Id);
        }
Exemple #5
0
 public void Delete(FakeNews fakeNews)
 {
     db.FakeNews.Remove(fakeNews);
     db.SaveChanges();
 }