public ActionResult Create() { var news = new News(); ViewData["AllTags"] = newsRepository.GetAllTags(); return View( news ); }
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" ); } }
public void Delete(News news) { db.News.DeleteOnSubmit( news ); }
public void Add( News news ) { db.News.InsertOnSubmit( news ); }
partial void DeleteNews(News instance);
partial void UpdateNews(News instance);
partial void InsertNews(News instance);
private void detach_News(News entity) { this.SendPropertyChanging(); entity.User = null; }
private void attach_News(News entity) { this.SendPropertyChanging(); entity.User = this; }