public ActionResult Index(TweetVM itemTweet) { try { if (ModelState.IsValid) { Tweet t = new Tweet() { UserId = Session["UserId"].ToString(), message = itemTweet.message, created = DateTime.Now }; obj.AddTweet(t); return(RedirectToAction("Index")); } else { return(View()); } } catch (Exception Ex) { Logger.WriteError(Ex, "Index", "Home"); return(View("Error")); } }
public ActionResult Delete(int id, TweetVM collection) { try { if (ModelState.IsValid) { Tweet t = new Tweet() { Tweet_Id = id, UserId = collection.UserId, message = collection.message, created = DateTime.Now }; obj.DeleteTweet(t); return(RedirectToAction("Index")); } else { return(View()); } } catch (Exception Ex) { Logger.WriteError(Ex, "Delete", "Home"); return(View("Error")); } }
public ActionResult Index(string search) { string userId = Session["UserId"].ToString(); string searchVal = Request.QueryString["search"]; TweetVM tweetData = new TweetVM(); Search searchResult = new Search(); if (string.IsNullOrEmpty(searchVal)) { if (Session["UserName"] != null) { tweetData.Tweets = tbl.GetTweets(userId); tweetData.Following = tbl.GetUserFollowingCount(userId); tweetData.Followers = tbl.GetUserFollowersCount(userId); tweetData.NoOfTweets = tbl.GetUserTweetCount(userId); return(View(tweetData)); } else { return(RedirectToAction("Login", "User")); } } else { Person person = ubl.SearchUser(searchVal); if (person != null) { searchResult.showDialog = true; } return(PartialView("_PartialSearchDialog", person)); } }
//[HttpPost] public ActionResult SearchUser(TweetVM collection) { try { if (collection.Search_User != null) { Session["SerchText"] = collection.Search_User; Person objPerson = new Person(); objPerson = obj.GetUser(Session["SerchText"].ToString()); if (objPerson != null) { var followStatus = obj.GetFollower(objPerson.UserId, Session["UserId"].ToString()); PersonVM personVM = new PersonVM() { UserId = objPerson.UserId, Name = objPerson.Name, Pwd = Decrypt(objPerson.Pwd).ToString(), Email = objPerson.Email, ProfileImage = objPerson.ProfileImage, Joined = objPerson.Joined, Active = objPerson.Active, status = "" }; if (followStatus != true) { personVM.followstatus = "false"; } else { personVM.followstatus = "true"; } return(View(personVM)); } else { PersonVM personVM = new PersonVM() { status = "No user found" }; return(View(personVM)); } } else { return(RedirectToAction("Index", "Home")); } } catch (Exception Ex) { Logger.WriteError(Ex, "SearchUser", "User"); return(View("Error")); } }
public ActionResult List() { TweetVM model = new TweetVM() { AppUsers = appUserService.GetActive(), Tweets = tweetService.GetActive().OrderByDescending(x => x.CreatedDate).ToList(), Comments = commentService.GetActive(), user = appUserService.GetByDefault(x => x.UserName == User.Identity.Name), }; return(View(model)); }
public ActionResult Index() { TweetVM model = new TweetVM() { appUser = _appUserService.FindByUserName(HttpContext.User.Identity.Name), AppUsers = _appUserService.GetActive(), Tweets = _tweetService.GetActive().OrderByDescending(x => x.CreatedDate).Take(10).ToList(), }; return(View(model)); }
public ActionResult Tweet(TweetVM collection) { try { List <Tweet> t = new List <Tweet>(); t = obj.GetTweet(Session["UserId"].ToString()); return(View(t)); } catch (Exception Ex) { Logger.WriteError(Ex, "Tweet", "Home"); return(View("Error")); } }
public ActionResult Delete(int id) { try { Tweet t = new Tweet(); t = obj.GetTweetbyID(id); TweetVM tweetVM = new TweetVM() { UserId = t.UserId, Tweet_Id = t.Tweet_Id, message = t.message, }; return(View(tweetVM)); } catch (Exception Ex) { Logger.WriteError(Ex, "Delete", "Home"); return(View("Error")); } }