public HttpResponseMessage GetSaleVendorCoupons(int saleNumber, int tillNumber, string tenderCode) { var dateStart = DateTime.Now; _performancelog.Debug($"Start,PaymentController,GetSaleVendorCoupons,{string.Empty},{dateStart:hh.mm.ss.ffffff}"); ErrorMessage errorMessage; string coupon = string.Empty; string userCode; HttpResponseMessage httpResponseMessage; if (GetUserCode(out userCode, out httpResponseMessage)) { return(httpResponseMessage); } AddVendorCouponResposeModel model = new AddVendorCouponResposeModel { SaleVendorCoupons = _paymentManager.GetSaleVendorCoupon(saleNumber, tillNumber, userCode, tenderCode, ref coupon, out errorMessage) }; if (!string.IsNullOrEmpty(errorMessage.MessageStyle.Message)) { return(Request.CreateResponse(HttpStatusCode.BadRequest, new ErrorResponse { Error = errorMessage.MessageStyle })); } if (model.SaleVendorCoupons.Count == 0 && !string.IsNullOrEmpty(coupon)) { model.DefaultCoupon = coupon; } _performancelog.Debug($"End,PaymentController,GetSaleVendorCoupons,{DateTime.Now.Subtract(dateStart).TotalMilliseconds},{DateTime.Now:hh.mm.ss.ffffff}"); return(Request.CreateResponse(HttpStatusCode.OK, model)); }
public HttpResponseMessage RemoveSaleVendorCoupon([FromBody] RemoveVendorCouponInputModel vendorCouponModel) { var dateStart = DateTime.Now; _performancelog.Debug($"Start,PaymentController,RemoveSaleVendorCoupon,{string.Empty},{dateStart:hh.mm.ss.ffffff}"); ErrorMessage errorMessage; string userCode; HttpResponseMessage httpResponseMessage; if (GetUserCode(out userCode, out httpResponseMessage)) { return(httpResponseMessage); } var model = new AddVendorCouponResposeModel { SaleVendorCoupons = _paymentManager.RemoveSaleVendorCoupon(vendorCouponModel.SaleNumber, vendorCouponModel.TillNumber, userCode, vendorCouponModel.TenderCode, vendorCouponModel.CouponNumber, out errorMessage) }; if (!string.IsNullOrEmpty(errorMessage.MessageStyle.Message)) { return(Request.CreateResponse(HttpStatusCode.BadRequest, new ErrorResponse { Error = errorMessage.MessageStyle })); } var updatedTenders = CacheManager.GetTenderForSale(vendorCouponModel.SaleNumber, vendorCouponModel.TillNumber); TenderSummaryModel tenderSummary = GetTenderSummary(updatedTenders); tenderSummary.VendorCoupons = model.SaleVendorCoupons; _performancelog.Debug($"End,PaymentController,RemoveSaleVendorCoupon,{DateTime.Now.Subtract(dateStart).TotalMilliseconds},{DateTime.Now:hh.mm.ss.ffffff}"); return(Request.CreateResponse(HttpStatusCode.OK, tenderSummary)); }