public async Task <HttpResponseMessage> CreateSourceNode(SourceNode sourceNode) { SourceNode sourceName = _entityLogic.GetSingle(c => c.Name == sourceNode.Name); if (sourceName != null) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, StatusCodes.NAME_ALREADY_EXIST)); } sourceNode.Id = 0; if (sourceNode.Status == "0") { sourceNode.Status = "Active"; } else { sourceNode.Status = "In-active"; } _entityLogic.Insert(sourceNode); _entityLogic.Save(); var getSourceNode = _entityLogic.GetSingle(c => c.Id == sourceNode.Id, c => c.Scheme); await _entityLogic.Pusher(getSourceNode, "sourcenode"); return(Request.CreateResponse(HttpStatusCode.OK, StatusCodes.CREATED)); }
public async Task <HttpResponseMessage> CreateFee(Fee fee) { var feeName = _entityLogic.GetSingle(c => c.Name == fee.Name); if (feeName != null) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, StatusCodes.NAME_ALREADY_EXIST)); } fee.Id = 0; if (fee.FlatAmount == 0) { fee.FlatAmount = null; } if (fee.PercentOfTrx == 0) { fee.PercentOfTrx = null; } if (fee.Maximum == 0) { fee.Maximum = null; } if (fee.Minimum == 0) { fee.Minimum = null; } _entityLogic.Insert(fee); _entityLogic.Save(); var getFees = _entityLogic.GetSingle(c => c.Id == fee.Id); await _entityLogic.Pusher(getFees, "fee"); return(Request.CreateResponse(HttpStatusCode.OK, StatusCodes.CREATED)); }
public async Task <HttpResponseMessage> CreateScheme(Route route) { var routeName = _entityLogic.GetSingle(c => c.Name == route.Name); if (routeName != null) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, StatusCodes.NAME_ALREADY_EXIST)); } route.Id = 0; _entityLogic.Insert(route); _entityLogic.Save(); var getRoutes = _entityLogic.GetSingle(c => c.Id == route.Id, c => c.SinkNode); await _entityLogic.Pusher(getRoutes, "route"); return(Request.CreateResponse(HttpStatusCode.OK, StatusCodes.CREATED)); }
public async Task <HttpResponseMessage> CreateScheme(Scheme scheme) { var schemeName = _entityLogic.GetSingle(c => c.Name == scheme.Name); if (schemeName != null) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, StatusCodes.NAME_ALREADY_EXIST)); } scheme.Id = 0; _entityLogic.Insert(scheme); _entityLogic.Save(); var getSchemes = _entityLogic.GetSingle(c => c.Id == scheme.Id, c => c.TransactionType, c => c.Channel, c => c.Route, c => c.Fee); await _entityLogic.Pusher(getSchemes, "scheme"); return(Request.CreateResponse(HttpStatusCode.OK, StatusCodes.CREATED)); }