Beispiel #1
0
        public bool CreateFackeData(ItemToCreateViewModel generateData)
        {
            var isSuccess = false;

            switch (generateData.ItemType)
            {
            case ItemType.Leads:
            {
                var leads = GenerateLeads(generateData.Count);
                _unitOfWork.LeadsRepository.AddRange(leads);
                isSuccess = true;
                break;
            }

            case ItemType.Customer:
            {
                var customers = GenerateUser(generateData.Count, _unitOfWork.DUserTypesRepository.Customer);
                _unitOfWork.UsersRepository.AddRange(customers);
                isSuccess = true;
                break;
            }

            case ItemType.AdminTeamMember:
            {
                var customers = GenerateUser(generateData.Count, _unitOfWork.DUserTypesRepository.AdminTeamMember);
                _unitOfWork.UsersRepository.AddRange(customers);
                isSuccess = true;
                break;
            }
            }

            return(isSuccess);
        }
Beispiel #2
0
        public ActionResult GenerateData(ItemToCreateViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var isSuccess = CreateFackeData(model);

            if (!isSuccess)
            {
                return(View(model));
            }

            _unitOfWork.Save();

            return(RedirectToAction(nameof(Index)));
        }
Beispiel #3
0
        public ActionResult GenerateData()
        {
            var itemToCreateViewModel = new ItemToCreateViewModel();

            return(View(itemToCreateViewModel));
        }