public IHttpActionResult Put(AssessorOtherDetail assessorOtherDetail, int assessorId) { OperationStatus operationStatus = new OperationStatus() { ServiceMethod = "PUT", ServiceName = "UpdateAssessorOtherDetail", RequestProcessed = false, RequestSuccessful = false }; if (assessorOtherDetail != null) { if (assessorId > 0) { //Comment : Here set value of assessorId into DTO object and then call Update method assessorOtherDetail.AssessorId = assessorId; operationStatus = GetAssessorOtherDetailDbService().UpdateOtherDetail(assessorOtherDetail); } else { operationStatus.Messages.Add(new Message() { DTOName = "AssessorOtherDetail", DTOProperty = "", MessageType = MessageType.SystemError, Text = "Please use POST method to create object." }); } } return(Ok(operationStatus)); }
private Int64 SubmitAssessorOtherDetails(AssessorOtherDetail data) { var parameterList = new List <System.Data.IDbDataParameter> { new SqlParameter() { ParameterName = "@AssessorId", Value = data.AssessorId, SqlDbType = SqlDbType.BigInt }, new SqlParameter() { ParameterName = "@OdigoOkayStatus", Value = data.OdigoOkayStatus, SqlDbType = SqlDbType.VarChar, Size = 20 }, new SqlParameter() { ParameterName = "@BankName", Value = data.BankName, SqlDbType = SqlDbType.VarChar, Size = 250 }, new SqlParameter() { ParameterName = "@AccountNumber", Value = data.AccountNumber, SqlDbType = SqlDbType.VarChar, Size = 20 }, new SqlParameter() { ParameterName = "@IFSC_Code", Value = data.IFSC_Code, SqlDbType = SqlDbType.VarChar, Size = 20 }, new SqlParameter() { ParameterName = "@BankAddress", Value = data.BankAddress, SqlDbType = SqlDbType.VarChar, Size = 500 }, new SqlParameter() { ParameterName = "@HighestQualificationId", Value = data.HighestQualificationId, SqlDbType = SqlDbType.Int }, new SqlParameter() { ParameterName = "@Qualifications", Value = data.Qualifications, SqlDbType = SqlDbType.VarChar, Size = 500 }, new SqlParameter() { ParameterName = "AssessorId", SqlDbType = SqlDbType.BigInt, Direction = ParameterDirection.ReturnValue } }; //Comment : Here get DbConnector object var rowEffeted = GetDbConnector().ExecuteNonQuery("MaintainAssessorOtherDetails", QueryCommandType.StoredProcedure, parameterList); //if successfully executed if (rowEffeted > 0) { Int64 assessorId = Convert.ToInt32(parameterList[parameterList.Count() - 1].Value); return(assessorId); } else { //LoggingService.Instance.Fatal(string.Format("Unable to add user :{0}{1}", Environment.NewLine, object)); } return(0); }
OperationStatus IAssessorOtherDetailDbService.AddOtherDetail(AssessorOtherDetail data) { OperationStatus operationStatus = new OperationStatus() { RequestProcessed = false, RequestSuccessful = false }; #region Comment : Here Add/Create details try { #region Supply data object for DB insertion //Comment : Here record id which is being effected at db level Int64 effectedRecordId = SubmitAssessorOtherDetails(data); //if successfully executed if (effectedRecordId > 0) { //Comment : Here if data has been "successfully submitted" then capture those details operationStatus.RequestProcessed = true; operationStatus.RequestSuccessful = true; operationStatus.ServiceName = "AddAssessorOtherDetail"; operationStatus.ServiceMethod = "POST"; operationStatus.AffectedIds.Add(new AffectedId() { DTOName = "AssessorOtherDetail", DTOProperty = "AssessorId", IdValue = effectedRecordId.ToString(), OperationType = OperationType.POST }); } else { //LoggingService.Instance.Fatal(string.Format("Unable to add user :{0}{1}", Environment.NewLine, object)); } #endregion } catch (Exception ex) { operationStatus.RequestProcessed = true; operationStatus.RequestSuccessful = false; operationStatus.Messages.Add(new Message() { DTOName = "AssessorOtherDetail", DTOProperty = "", MessageType = MessageType.SystemError, Text = ex.Message }); } #endregion return(operationStatus); }
public IHttpActionResult Post(AssessorOtherDetail assessor) { OperationStatus operationStatus = new OperationStatus() { ServiceMethod = "POST", ServiceName = "AddAssessorOtherDetail", RequestProcessed = false, RequestSuccessful = false }; if (assessor != null) { if (assessor.AssessorId > 0) { operationStatus = GetAssessorOtherDetailDbService().AddOtherDetail(assessor); } //else //{ // operationStatus.Messages.Add(new Message() { DTOName = "AssessorOtherDetail", DTOProperty = "", MessageType = MessageType.SystemError, Text = "Please use PUT method to update state of object." }); //} } return(Ok(operationStatus)); }