public void FindByNameClient() { clientsManagment.Load(); Client cli = new Client("Nik", "ghhghg", 1100); clientsManagment.Insert(cli); clientsManagment.SaveChanges(); clientsManagment.Load(); clientsManagment.Find(x => x.Email == "Nik"); Assert.AreEqual(cli.Money, clientsManagment.Find(x => x.Email == "Nik").ElementAt(1).Money); }
public ActionResult Registration(string email, string password) { ClientsManagment var = new ClientsManagment(); // Shop.RegistryClient(email, password, 510); var.unitOfWork.Clients.Insert(new Client(email, password, 5120)); var.SaveChanges(); var.Load(); ViewBag.Message = "Succesfully registred"; return(View("Index")); }
public void Run() { while (true) { SaveIt(); Console.ForegroundColor = ConsoleColor.Magenta; Console.Clear(); string message = "\t\t\tMenu\n1.Add Client\t2.Choose Client\n3.Add Service\n4.Show Portfolio\n5.Show Clients\n0. Exit"; Console.WriteLine(message); string arg = Console.ReadLine(); switch (arg) { case "0": services.SaveChanges(); clients.SaveChanges(); Environment.Exit(0); break; case "1": Console.ForegroundColor = ConsoleColor.Red; try { AddClient(); } catch (Exception e) { Console.WriteLine($"{e.Message}\nPress any key to continue..."); Console.ReadKey(); } break; case "2": Console.ForegroundColor = ConsoleColor.Yellow; try { SaveIt(); ChooseCLient(); } catch (Exception e) { Console.WriteLine($"{e.Message}\nPress any key to continue..."); Console.ReadKey(); } break; case "3": Console.ForegroundColor = ConsoleColor.Green; try { AddService(); } catch (Exception e) { Console.WriteLine($"{e.Message}\nPress any key to continue..."); Console.ReadKey(); } break; case "4": Console.ForegroundColor = ConsoleColor.Green; try { ShowPortfolio(); //services.Find(); Console.ReadKey(); } catch (Exception e) { Console.WriteLine($"{e.Message}\nPress any key to continue..."); Console.ReadKey(); } break; case "5": Console.ForegroundColor = ConsoleColor.Green; try { ShowClients(); Console.ReadKey(); } catch (Exception e) { Console.WriteLine($"{e.Message}\nPress any key to continue..."); Console.ReadKey(); } break; default: Console.WriteLine("Wrong input\nPress any key to continue"); Console.ReadKey(); break; } } }