internal StripeModel GetStripeInfo(Entity objReq) { using (var db = new WizzDataContext()) { var userData = db.tblUsers.Where(x => x.pkUserId == Convert.ToInt64(objReq.userId)).FirstOrDefault(); StripeModel objStripe = new StripeModel(); objStripe.stripeAcKey = userData.stripeId; objStripe.stripeLiveKey = Constants.stripeLiveKey; objStripe.stripeSecretKey = Constants.stripeSecretKey; return objStripe; } }
internal bool SaveStripeDetails(StripeModel objReq) { using (var db = new WizzDataContext()) { tblUser userData = new tblUser(); userData = db.tblUsers.Where(x => x.pkUserId == Convert.ToInt64(objReq.userId)).FirstOrDefault(); userData.stripeId = objReq.stripeAcKey; db.SubmitChanges(); return true; } }
public Response<string> SaveStripeDetails(StripeModel objReq) { Response<string> response = new Response<string>(); List<string> objResp = new List<string>(); try { StripeMethods obj = new StripeMethods(); if (CheckRequestIsvalidornot(this.Request)) { if (ModelState.IsValid) { if (obj.SaveStripeDetails(objReq)) response.Create(true, Messages.FormatMessage(Messages.Success, "Stripe credentials saved"), Messages.AppVersion, objResp); else response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp); } else response.Create(false, ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage, Messages.AppVersion, objResp); } else response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp); } catch (Exception ex) { object session = new JavaScriptSerializer().Serialize(objReq); LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message); response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp); } return response; }