public List<WallDto> GetCommentsForUser(int userID) { var userWalls = WallRepository.GetCommentsForUser(userID); var userWallDtos = new List<WallDto>(); foreach (var comments in userWalls) { var dto = new WallDto(comments); userWallDtos.Add(dto); } return userWallDtos; }
public void Post(WallDto model) { try { var sender = GetLoggedInUser(); DateTime CommentDate = DateTime.Now; if (ModelState.IsValid) { WallRepository.AddWallComment(model.WallOwnerID, sender.UserID, model.Comment, CommentDate); } } catch (Exception) { } }