//Controller [Route("~/api/REmaapClassicView/UpdateRecordFeedback")] [HttpPost] public string UpdateRecordFeedback(JObject RecordfdJsonvalue) { string StrResult = string.Empty; strIPAddressError = IsallowedIPAddress(); try { if (strIPAddressError.ToUpper() == "TRUE") { StrResult = _BLL.UpdateRecordFeedback(RecordfdJsonvalue); } else { return strIPAddressError; } } catch (Exception ex) { Log.WriteLog(ex, _logdetails); } return StrResult; } [Route("~/api/REmaapClassicView/DeleteRecordFeedback")] [HttpPost] public string DeleteRecordFeedback(string Pkey) { string StrResult = string.Empty; strIPAddressError = IsallowedIPAddress(); try { if (strIPAddressError.ToUpper() == "TRUE") { StrResult = _BLL.DeleteRecordFeedback(Pkey); } else { return strIPAddressError; } } catch (Exception ex) { Log.WriteLog(ex, _logdetails); } return StrResult; } //business layer public string UpdateRecordFeedback(JObject RecordfdJsonvalue) { string Status = string.Empty; string Msg = string.Empty; string strResult = string.Empty; string strProjectKey = string.Empty, strPkey = string.Empty, strSectionkey = string.Empty, strLeasekey = string.Empty, fkeyFeedbacksource = string.Empty, strUserKey = string.Empty, fkeyFeedbacktype = string.Empty, feedbackDescription = string.Empty, feedbackResponsecomments = string.Empty, strReporteddate = string.Empty; List lstQuery = new List(); try { dynamic JSONValue = JArray.Parse("[" + RecordfdJsonvalue + "]"); DBConnection dbcMaster = new DBConnection(_configuration.GetSection("REmaapSettings").GetSection("MasterConnectionString").Value); if (JSONValue.Count > 0) { strPkey = Convert.ToString(JSONValue[0].strPkey); //strProjectKey = Convert.ToString(JSONValue[0].strProjectKey); //strLeasekey = Convert.ToString(JSONValue[0].strLeasekey); strSectionkey = Convert.ToString(JSONValue[0].strSectionkey); fkeyFeedbacksource = Convert.ToString(JSONValue[0].fkeyFeedbacksource); fkeyFeedbacktype = Convert.ToString(JSONValue[0].fkeyFeedbacktype); strReporteddate = Convert.ToString(JSONValue[0].strReporteddate); feedbackDescription = Convert.ToString(JSONValue[0].feedbackDescription); feedbackResponsecomments = Convert.ToString(JSONValue[0].feedbackResponsecomments); strUserKey = Convert.ToString(JSONValue[0].modifiedby); } if (!string.IsNullOrEmpty(strPkey) && !string.IsNullOrEmpty(strSectionkey) && !string.IsNullOrEmpty(feedbackDescription) && !string.IsNullOrEmpty(strUserKey) && !string.IsNullOrEmpty(strReporteddate)) { lstQuery.Add("UPDATE Report_Feedback_Details SET FKEY_SECTIONKEY = '" + strSectionkey + "',FKEY_FEEDBACK_SOURCE = '" + fkeyFeedbacksource + "',FKEY_FEEDBACK_TYPE = '" + fkeyFeedbacktype + "',REPORTED_DATE = '" + strReporteddate + "',FEEDBACK_DESCRIPTION ='" + _DAL.stripQuotes(feedbackDescription) + "'," + "FEEDBACK_RESPONSE_COMMENTS = '" + _DAL.stripQuotes(feedbackResponsecomments) + "',Modified_By = '" + strUserKey + "',Modified_On = NOW() WHERE PKEY = '" + strPkey + "'"); if (lstQuery.Count > 0) { dbcMaster.executeNonQuery(lstQuery.ToArray()); Status = "\"Status\" : " + "\"Success\""; Msg = "\"Message\" : \"Updated Succesfully\""; } } else { Status = "\"Status\" : " + "\"Error\""; Msg = "\"Message\" : \"Error on Updating the Values\""; } } catch (Exception ex) { _logDetails.strprojkey = strProjectKey; Log.WriteLog(ex, _logDetails); Status = "\"Status\" : " + "\"Error\""; Msg = "\"Message\" : \"" + ex.Message.ToString() + "\""; } strResult = "{" + Status + "," + Msg + "}"; return strResult; } public string DeleteRecordFeedback(string Pkey) { string Status = string.Empty; string Msg = string.Empty; string strResult = string.Empty; List lstQuery = new List(); DBConnection dbcMaster = new DBConnection(_configuration.GetSection("REmaapSettings").GetSection("MasterConnectionString").Value); try { string RecordPkey = Pkey; if (!string.IsNullOrEmpty(RecordPkey)) { lstQuery.Add(" DELETE FROM report_feedback_details WHERE pkey ='" + RecordPkey + "' "); if (lstQuery.Count > 0) { dbcMaster.executeNonQuery(lstQuery.ToArray()); Status = "\"Status\" : " + "\"Success\""; Msg = "\"Message\" : \"Deleted Succesfully\""; } } else { Status = "\"Status\" : " + "\"Error\""; Msg = "\"Message\" : \"Error on Deleting the records\""; } } catch(Exception ex) { Log.WriteLog(ex, _logDetails); Status = "\"Status\" : " + "\"Error\""; Msg = "\"Message\" : \"" + ex.Message.ToString() + "\""; } strResult = "{" + Status + "," + Msg + "}"; return strResult; }