// // GET: /NewsFeedItem/Create public ActionResult Create(int ? ItemType = -1) { NewsFeedItem n = new NewsFeedItem(); n.ItemType = (int)ItemType; ViewBag.type = ItemType; if (ItemType <= 0 || ItemType > 4) return RedirectToAction("Index", "NewsFeed"); return View(n); }
public ActionResult Create(NewsFeedItem newsfeeditem) { if (ModelState.IsValid) { newsfeeditem.ID = Guid.NewGuid(); newsfeeditem.Created = DateTime.Now; newsfeeditem.Modified = DateTime.Now; newsfeeditem.UserID = _userRepo.FindAll(u => u.UserName == User.Identity.Name).FirstOrDefault().ID; _newsFeedItemRepo.Add(newsfeeditem); return RedirectToAction("Index", "NewsFeed"); } return View(newsfeeditem); }
public void Setup() { _newsFeedItem = new NewsFeedItem(); }