public WallDto(Wall w) { this.WallOwnerID = w.WallOwnerID; this.WallSenderID = w.SenderID; this.Comment = w.Comment; this.CommentDate = w.Date; this.FirstName = w.User1.FirstName; this.LastName = w.User1.LastName; }
//Lägger till kommentaren som användaren(senderID) kommenteraren(comment) på personens(wallOwnerID) wall public static void AddWallComment(int wallOwnerID, int senderID, string comment, DateTime date) { using (var context = new DatabaseEntities()) { Wall w = new Wall { WallOwnerID = wallOwnerID, SenderID = senderID, Comment = comment, Date = date }; context.Walls.Add(w); context.SaveChanges(); } }
public ActionResult PostWallMessage(ProfileModel model,int ReciverID) { var currentlyLoggedInUserId = (int)Session["UserId"]; if (!ModelState.IsValid) { return View(model); } var wall = new Wall(); wall.Date = DateTime.Now; wall.ReciverID = ReciverID; wall.TheMessage = model.wallMessage; wall.SenderID = currentlyLoggedInUserId; WallRepository.postWallMessage(wall); return RedirectToAction("VisitProfile", "Profile",new {userid=ReciverID}); }