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); }
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))); }
public ActionResult GenerateData() { var itemToCreateViewModel = new ItemToCreateViewModel(); return(View(itemToCreateViewModel)); }