Esempio n. 1
0
        public ActionResult Create()
        {
            var news = new News();
            ViewData["AllTags"] = newsRepository.GetAllTags();

            return View( news );
        }
Esempio n. 2
0
        public ActionResult Create( FormCollection collection )
        {
            var news = new News();
            try
            {
                // TODO: Add insert logic here
                UpdateModel( news );
                news.created_at = DateTime.UtcNow;
                news.ip_address = System.Web.HttpContext.Current.Request.UserHostAddress;
                news.author_id = newsRepository.GetAuthorId( User.Identity.Name );
                news.voted_for = 0;
                news.voted_against = 0;
                news.state = 0;
                news.type = 0;
                news.views = 0;
                news.hits = 0;

                newsRepository.Add( news );
                newsRepository.Save();
                newsRepository.TagsJob( Request.Form["tags"], news.id );

                return RedirectToAction( "Index" );
            }
            catch
            {
                return View( "Error" );
            }
        }
Esempio n. 3
0
 public void Delete(News news)
 {
     db.News.DeleteOnSubmit( news );
 }
Esempio n. 4
0
 public void Add( News news )
 {
     db.News.InsertOnSubmit( news );
 }
Esempio n. 5
0
 partial void DeleteNews(News instance);
Esempio n. 6
0
 partial void UpdateNews(News instance);
Esempio n. 7
0
 partial void InsertNews(News instance);
Esempio n. 8
0
		private void detach_News(News entity)
		{
			this.SendPropertyChanging();
			entity.User = null;
		}
Esempio n. 9
0
		private void attach_News(News entity)
		{
			this.SendPropertyChanging();
			entity.User = this;
		}