public IActionResult OnPostComments(Comments comments) { var cmt_ip = HttpContext.Connection.RemoteIpAddress.ToString(); comments.Status = "0"; comments.AuthorIp = cmt_ip; comments.CommentDate = DateTime.Now; comments.CommentDateGmt = DateTime.Now.ToUniversalTime(); repositoryData.AddComments(comments); int result = repositoryData.Commit(); if (result > 0) { return(Json(new { success = true, message = "Your comments added successfully" })); } return(Json(new { success = false, message = "Error while adding comments. Pls tyr again later." })); }