DestinationResponse Map(tblRequestResponceDestination dest) { if (dest == null) return null; DestinationResponse desitintion = new DestinationResponse { address=dest.Address, timeStamp=dest.ResponseTimeStamp, messageId=dest.MessageId, statusCode=dest.StatusCode, statusDetail=dest.StatusDetails }; return desitintion; }
public int Save(RequestResponse entity) { tblRequestResponce tblresponse = new tblRequestResponce(); tblresponse.DateCreated = DateTime.Now; tblresponse.MessageId = entity.messageId; tblresponse.ReferenceId = entity.ReferenceId; tblresponse.StatusCode = entity.statusCode; tblresponse.StatusDetails = entity.statusDetail; tblresponse.Vesion = entity.version; foreach (DestinationResponse edest in entity.DesinationResponses) { tblRequestResponceDestination dest = new tblRequestResponceDestination(); dest.Address = edest.address; dest.DateCreated = DateTime.Now; dest.ResponseTimeStamp = edest.timeStamp; dest.StatusCode = edest.statusCode; dest.StatusDetails = edest.statusDetail; dest.MessageId = edest.messageId; tblresponse.tblRequestResponceDestination.Add(dest); } _ctx.tblRequestResponce.Add(tblresponse); _ctx.SaveChanges(); return tblresponse.Id; }