public IHttpActionResult Put(AssessorIdProofDetail assessorIdProofDetail, int assessorIdProofDetailId = 0) { OperationStatus operationStatus = new OperationStatus() { ServiceMethod = "PUT", ServiceName = "UpdateAssessorIdProofDetail", RequestProcessed = false, RequestSuccessful = false }; if (assessorIdProofDetail != null) { if (assessorIdProofDetailId > 0) { //Comment : Here set value of assessorIdProofDetailId into DTO object and then call Update method assessorIdProofDetail.Id = assessorIdProofDetailId; operationStatus = GetAssessorIdProofDetailDbService().UpdateIdProofDetail(assessorIdProofDetail); } else { operationStatus.Messages.Add(new Message() { DTOName = "AssessorIdProofDetail", DTOProperty = "", MessageType = MessageType.SystemError, Text = "Please use POST method to create object." }); } } return(Ok(operationStatus)); }
OperationStatus IAssessorIdProofDetailDbService.AddIdProofDetail(AssessorIdProofDetail 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 = SubmitAssessorIdProofDetails(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 = "AddAssessorIdProofDetail"; operationStatus.ServiceMethod = "POST"; operationStatus.AffectedIds.Add(new AffectedId() { DTOName = "AssessorIdProofDetail", 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 = "AssessorIdProofDetail", DTOProperty = "", MessageType = MessageType.SystemError, Text = ex.Message }); } #endregion return(operationStatus); }
public IHttpActionResult Post(AssessorIdProofDetail assessorIdProofDetail) { OperationStatus operationStatus = new OperationStatus() { ServiceMethod = "POST", ServiceName = "AddAssessorIdProofDetail", RequestProcessed = false, RequestSuccessful = false }; if (assessorIdProofDetail != null) { if (assessorIdProofDetail.Id == 0) { operationStatus = GetAssessorIdProofDetailDbService().AddIdProofDetail(assessorIdProofDetail); } else { operationStatus.Messages.Add(new Message() { DTOName = "AssessorIdProofDetail", DTOProperty = "", MessageType = MessageType.SystemError, Text = "Please use PUT method to update state of object." }); } } return(Ok(operationStatus)); }
private Int64 SubmitAssessorIdProofDetails(AssessorIdProofDetail data) { var parameterList = new List <System.Data.IDbDataParameter> { new SqlParameter() { ParameterName = "@Id", Value = data.Id, SqlDbType = SqlDbType.BigInt }, new SqlParameter() { ParameterName = "@AssessorId", Value = data.AssessorId, SqlDbType = SqlDbType.BigInt }, new SqlParameter() { ParameterName = "@IdProofTypeId", Value = data.IdProofTypeId, SqlDbType = SqlDbType.Int }, new SqlParameter() { ParameterName = "@UniqueNumber", Value = data.UniqueNumber, SqlDbType = SqlDbType.VarChar, Size = 30 }, new SqlParameter() { ParameterName = "@NameOnDocument", Value = data.NameOnDocument, SqlDbType = SqlDbType.VarChar, Size = 200 }, new SqlParameter() { ParameterName = "@DocumentFileName", Value = data.DocumentFileName, SqlDbType = SqlDbType.VarChar, Size = 50 }, //5S Params new SqlParameter() { ParameterName = "@CreatedBy", Value = data.CreatedBy, SqlDbType = SqlDbType.Int }, new SqlParameter() { ParameterName = "@ModifiedBy", Value = data.ModifiedBy, SqlDbType = SqlDbType.Int }, new SqlParameter() { ParameterName = "@IsActive", Value = data.IsActive, SqlDbType = SqlDbType.Bit }, new SqlParameter() { ParameterName = "AssessorIdProofDocMappingId", SqlDbType = SqlDbType.BigInt, Direction = ParameterDirection.ReturnValue } }; //Comment : Here get DbConnector object var rowEffeted = GetDbConnector().ExecuteNonQuery("MaintainAssessorIdProofDetails", QueryCommandType.StoredProcedure, parameterList); //if successfully executed if (rowEffeted > 0) { Int64 assessorIdProofDocMappingId = Convert.ToInt64(parameterList[parameterList.Count() - 1].Value); return(assessorIdProofDocMappingId); } else { //LoggingService.Instance.Fatal(string.Format("Unable to add user :{0}{1}", Environment.NewLine, object)); } return(0); }