public ActionResult Details(HomeDetailsVM model) { if (string.IsNullOrEmpty(model.Comment)) return RedirectToAction("Details", new { videoId = model.VideoId }); var user = IdentityHelper.GetUserFromIdentity(); var comment = new Comment(model.VideoId, IdentityHelper.GetUserToken(), model.Comment, user.Username); this._videoRepository.AddComment(comment); return RedirectToAction("Details", new { videoId = model.VideoId }); }
public Comment AddComment(Comment comment) { var client = _storageAccount.CreateCloudTableClient(); var table = client.GetTableReference(TableStorageConstants.CommentTableKey); var insertOperation = TableOperation.Insert(comment); table.Execute(insertOperation); return comment; }