public JsonResult SXSS_S1_Comment(SXSS_S1_CommentRequest request) { SXSS_S1_CommentListResponse response = new SXSS_S1_CommentListResponse(); if (!GoogleRecaptchaControl(request.SXSS_S1_CommentRequest_gReCaptcha)) { response.IsSuccess = false; response.Message = "Not valid gReCaptcha!"; response.ResponseCode = 400; } else { response = XSS_BusinessServices.SXSS_S1_Comment(request); } string commentListHTML = RazorViewToString.RenderRazorViewToString(this, "~/Views/Xss/StoredXss/_CommentList.cshtml", response); return(Json(new object[] { commentListHTML, response })); }
public static SXSS_S1_CommentListResponse SXSS_S1_Comment(SXSS_S1_CommentRequest request) { SXSS_S1_CommentListResponse response = new SXSS_S1_CommentListResponse(); using (var dbContext = new MSSQL_EF_CF_Context()) { try { dbContext.XSS_Comment.Add(XSS_Mapping.SXSS_S1_CommentRequest_To_XSS_Comment(request)); dbContext.SaveChanges(); response.CommentList = XSS_Mapping.XSS_Comment_To_SXSS_S1_CommentView(dbContext.XSS_Comment.OrderByDescending(x => x.ID).Take(5).ToList()); } catch (Exception ex) { response.Message = "Yorum kaydı başarısız" + ex.Message; response.ResponseCode = 500; } } return(response); }
public static XSS_Comment SXSS_S1_CommentRequest_To_XSS_Comment(SXSS_S1_CommentRequest request) { return(Mapper.Map <SXSS_S1_CommentRequest, XSS_Comment>(request)); }