public ApiModel CardSwipe([FromUri] ApiModel model, string cardswipedata, int buttonindex) { OnTheFlyResource otfr = ReservationOnTheFlyUtil.GetOnTheFlyResource(cardswipedata, buttonindex); if (null == otfr) { model.ServerResponse = "OnTheFlyResource not found for " + cardswipedata + " , buttonindex: " + buttonindex.ToString(); } else { OnTheFlyImpl oimp = new OnTheFlyImpl(otfr, cardswipedata, Request.GetOwinContext().Request.RemoteIpAddress); oimp.Swipe(); string strFS = (oimp.IsProcessFailed()) ? "failed" : "started"; model.ServerResponse = otfr.GetResourceTypeAsString() + "_reservation_" + strFS; model.ResourceType = otfr.ResourceType; bool returnLog = Utility.StringToBoolean(ConfigurationManager.AppSettings["otf:ReturnFullLog"]); if (returnLog) { model.ServerResponse += oimp.GetReturnMessage(); } } return(model); }
protected override bool IsAuthorized(HttpActionContext actionContext) { if (ReservationOnTheFlyUtil.IsValidIP(GetIPAddress())) { return(true); } return(ErrorResult("Unauthorized")); }