public IActionResult AddBankDetails(int candidateID, CandidateBankDetailRequest bankDetail) { try { bool success = false; string message; var data = _fellowshipBusiness.AddCandidateBankDetails(candidateID, bankDetail); if (data != null) { success = true; message = "Fellowship Candidate Bank Details Added Successfully"; return(Ok(new { success, message, data })); } else { message = "Try Again!"; return(NotFound(new { success, message })); } } catch (Exception ex) { return(BadRequest(new { ex.Message })); } }
public CandidateBankDetailResponse AddCandidateBankDetails(int candidateID, CandidateBankDetailRequest bankDetail) { var responseData = _hiredRepository.AddCandidateBankDetails(candidateID, bankDetail); return(responseData); }
/// <summary> /// It Adds Candidate Bank Details in the database /// </summary> /// <param name="candidateID">CandidateID</param> /// <param name="bankDetail">Bank Details</param> /// <returns>If Data Added Successfully return ResponseData else null or Exception</returns> public CandidateBankDetailResponse AddCandidateBankDetails(int candidateID, CandidateBankDetailRequest bankDetail) { try { CandidateBankDetailResponse responseData = null; try { using (SqlConnection conn = new SqlConnection(sqlConnectionString)) { SqlCommand cmd = new SqlCommand("spAddCandidateBankDetails", conn) { CommandType = System.Data.CommandType.StoredProcedure }; cmd.Parameters.AddWithValue("@CandidateID", candidateID); cmd.Parameters.AddWithValue("@Name", bankDetail.Name); cmd.Parameters.AddWithValue("@AccountNumber", bankDetail.AccountNumber); cmd.Parameters.AddWithValue("@IsAccountNumberVerified", bankDetail.IsAccountNumberVerified); cmd.Parameters.AddWithValue("@IfscCode", bankDetail.IfscCode); cmd.Parameters.AddWithValue("@IsIfscCodeVerified", bankDetail.IsIfscCodeVerified); cmd.Parameters.AddWithValue("@PanNumber", bankDetail.PanNumber); cmd.Parameters.AddWithValue("@IsPanNumberVerified", bankDetail.IsPanNumberVerified); cmd.Parameters.AddWithValue("@AdhaarNumber", bankDetail.AdhaarNumber); cmd.Parameters.AddWithValue("@IsAdhaarNumberVerified", bankDetail.IsAdhaarNumberVerified); cmd.Parameters.AddWithValue("@CreatorStamp", bankDetail.CreatorStamp); cmd.Parameters.AddWithValue("@CreatorUser", bankDetail.CreatorUser); cmd.Parameters.AddWithValue("@CreatedDate", DateTime.Now); cmd.Parameters.AddWithValue("@ModifiedDate", DateTime.Now); conn.Open(); SqlDataReader dataReader = cmd.ExecuteReader(); while (dataReader.Read()) { responseData = new CandidateBankDetailResponse() { ID = Convert.ToInt32(dataReader["ID"].ToString()), CandidateID = Convert.ToInt32(dataReader["CandidateID"].ToString()), Name = dataReader["Name"].ToString(), AccountNumber = dataReader["AccountNumber"].ToString(), IsAccountNumberVerified = Convert.ToBoolean(dataReader["IsAccountNumberVerified"]), IfscCode = dataReader["IfscCode"].ToString(), IsIfscCodeVerified = Convert.ToBoolean(dataReader["IsIfscCodeVerified"]), PanNumber = dataReader["PanNumber"].ToString(), IsPanNumberVerified = Convert.ToBoolean(dataReader["IsPanNumberVerified"]), AdhaarNumber = dataReader["AdhaarNumber"].ToString(), IsAdhaarNumberVerified = Convert.ToBoolean(dataReader["IsAdhaarNumberVerified"]), CreatorStamp = dataReader["CreatorStamp"].ToString(), CreatorUser = dataReader["CreatorUser"].ToString(), CreatedDate = Convert.ToDateTime(dataReader["CreatedDate"]), ModifiedDate = Convert.ToDateTime(dataReader["ModifiedDate"]) }; } conn.Close(); } return(responseData); } catch { return(null); } } catch (Exception ex) { throw new Exception(ex.Message); } }