private void GenratePins(FranchiseIncome franchiseIncome, FranchiseIncomeReq model) { var _totalPins = model.Pins + model.FreePins; for (int i = 0; i < _totalPins; i++) { var _userPin = new UserPin(); _userPin.ID = Guid.NewGuid(); _userPin.FranchiseIncomeID = franchiseIncome.ID.ToString(); _userPin.Pin = _franchiseUtilities.GetRandomPin(); _userPin.IsUsed = false; _userPin.CreatedOn = DateTime.Now; _userPinRepository.Add(_userPin); } }
public FranchiseIncome AddNewFrenchise(FranchiseIncomeReq model) { var _ID = Guid.NewGuid(); var _oData = _franchiseIncomeRepository.Get(_ID); if (_oData == null) { var _frenchiseIncome = new FranchiseIncome(); _frenchiseIncome.ID = _ID; _frenchiseIncome.UserID = Guid.Parse(model.UserID); _frenchiseIncome.FranchiseIncomeTypeID = model.FrenchiseIncomeTypeID; _frenchiseIncome.TotalAmount = model.Amount; _frenchiseIncome.Income = model.Amount; _frenchiseIncome.CreatedOn = DateTime.Now; _frenchiseIncome.IsActive = false; _franchiseIncomeRepository.Add(_frenchiseIncome); _unitOfWork.Commit(); } return(_oData); }