internal async Task <ResponseModel> SaveExternalConsultant(ExternalConsultant source, int loginId) { ResponseModel response = new ResponseModel() { ErrorMessage = "Question not saved, please try again.", RequestType = Constants.RequestType.POST, ResultStatus = -1 }; using (IDbConnection conn = _dbConnection.Connection) { DynamicParameters param = new DynamicParameters(); if (source.consultantid > 0) { param.Add("@Id", source.consultantid, DbType.Int32); } param.Add("@Email", source.email.Trim(), DbType.String); param.Add("@ContactNumber", source.contactnumber.Trim(), DbType.String); param.Add("@WorkStatus", source.workauthorization.Trim(), DbType.String); param.Add("@TotalExperience", source.totalexperience.Trim(), DbType.String); param.Add("@RelevantExperience", source.relevantexperience.Trim(), DbType.String); param.Add("@Technology", source.technology.Trim(), DbType.String); param.Add("@location", source.currentlocation.Trim(), DbType.String); param.Add("@CanRelocate", source.canrelocate, DbType.Boolean); param.Add("@InProject", source.inproject, DbType.Boolean); param.Add("@NoticePeriod", source.noticeperiod.Trim(), DbType.String); param.Add("@Education", source.education.Trim(), DbType.String); param.Add("@Certification", source.certification.Trim(), DbType.String); param.Add("@IdType", source.identificationtype.Trim(), DbType.String); param.Add("@IdNumber", source.identificationid.Trim(), DbType.String); param.Add("@AdditionalInfo", source.additionalinfo.Trim(), DbType.String); if (source.responses != null && source.responses.Count > 0) { ////Todo: need to add params. } param.Add("@LoginUserId", loginId, DbType.Int32); var data = await conn.QueryAsync <int>(Constants.StoredProcedure.MANAGEEXTERNALCONSULTANTS, param, null, null, CommandType.StoredProcedure); int result = 0; if (data.ToList().Count > 0) { result = data.ToList()[0]; } response.ResultStatus = result; response.RequestType = Constants.RequestType.POST; response.SuccessMessage = result == 0 ? string.Empty : "External Consultant information saved successfully."; response.ErrorMessage = result == 0 ? "Error occurred while saving external consultant information. Please try again." : string.Empty; } return(response); }
public async Task <HttpResponseMessage> SaveExternalConsultant(ExternalConsultant source) { ResponseModel result = await VisaDal.Instance.SaveExternalConsultant(source, 1); return(sendResult(result)); }