public ActionResult RedumptionData() { var UserSession = (CustomerDetail)Session["ChitaleUser"]; RedemptionModel objData = new RedemptionModel(); objData = pr.GetRedemptionData(UserSession.CustomerId); return(View(objData)); }
public RedemptionModel SaveRedemptionModel(RedemptionModel model) { model.ValidateModel(); RedemptionModel result = null; Bet dataModel = null; using (var db = new CFLSuiteDB()) { if (model.BetID > 0) { dataModel = db.Bets.First(x => x.BetID == model.BetID); dataModel.BetStarted = model.BetStarted; dataModel.Description = model.Description; dataModel.ThrowID = model.ThrowID; dataModel.ParentBetID = model.ParentBetID; var participant = db.Participants.FirstOrDefault(x => x.BetID == model.BetID && x.PlayerID == model.PlayerID); if (participant == null) { participant = new Participant { PlayerID = model.PlayerID, Winner = false, }; dataModel.Participants.Add(participant); } } else { dataModel = new Bet { BetStarted = model.BetStarted, Description = model.Description, ThrowID = model.ThrowID, ParentBetID = model.ParentBetID, Participants = new List <Participant>() { new Participant { PlayerID = model.PlayerID, Winner = false } } }; db.Bets.Add(dataModel); } db.SaveChanges(); result = db.Bets.Where(x => x.BetID == dataModel.BetID).ToRedemptionModel().First(); } return(result); }
public RedemptionModel DeleteRedemptionModel(RedemptionModel model) { var result = model; using (var db = new CFLSuiteDB()) { var existing = db.Bets.First(x => x.BetID == model.BetID); db.Bets.Remove(existing); } return(result); }
public RedemptionModel GetRedemptionData(string CustomerId) { RedemptionModel objData = new RedemptionModel(); CustomerDetail objCustomerDetail = new CustomerDetail(); using (var context = new ChitaleDBContext()) { objCustomerDetail = context.CustomerDetails.Where(x => x.CustomerId == CustomerId).FirstOrDefault(); if (objCustomerDetail != null) { objData.DepositData = objCustomerDetail.Deposit; objData.CreditData = objCustomerDetail.CashIncentive; objData.InfraData = objCustomerDetail.InfraStructure; objData.PromoData = objCustomerDetail.Promotion; objData.DepositDataStr = String.Format(new CultureInfo("en-IN", false), "{0:n}", Convert.ToDecimal(objCustomerDetail.Deposit)); objData.CreditDataStr = String.Format(new CultureInfo("en-IN", false), "{0:n}", Convert.ToDecimal(objCustomerDetail.CashIncentive)); objData.InfraDataStr = String.Format(new CultureInfo("en-IN", false), "{0:n}", Convert.ToDecimal(objCustomerDetail.InfraStructure)); objData.PromoDataStr = String.Format(new CultureInfo("en-IN", false), "{0:n}", Convert.ToDecimal(objCustomerDetail.Promotion)); } } return(objData); }
public ActionResult DeleteRedemptionModel([DataSourceRequest] DataSourceRequest req, RedemptionModel model) { var result = model; try { result = new BetService().DeleteRedemptionModel(model); } catch (Exception e) { ModelState.AddModelError("Error", e.Message); } return(Json(new[] { result }.ToDataSourceResult(req, ModelState))); }
public RedemptionModel SaveRedemptionModel(RedemptionModel model) { return(new BetAccessor().SaveRedemptionModel(model)); }
public RedemptionModel DeleteRedemptionModel(RedemptionModel model) { return(new BetAccessor().DeleteRedemptionModel(model)); }