Exemple #1
0
 public List <V_CabDriver> GetList()
 {
     using (var ctx = new TaxiOperatorContext())
     {
         return(ctx.V_CabDrivers.ToList());
     }
 }
Exemple #2
0
 public User Find(string userName, string password)
 {
     using (var ctx = new TaxiOperatorContext())
     {
         return(ctx.Users.FirstOrDefault(x => x.UserName == userName && x.Password == password));
     }
 }
Exemple #3
0
 public void Update()
 {
     using (var ctx = new TaxiOperatorContext())
     {
         ctx.Entry(this).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
         ctx.SaveChanges();
     }
 }
Exemple #4
0
 public Customer GetRandom()
 {
     using (var ctx = new TaxiOperatorContext())
     {
         int toSkip = new Random().Next(0, ctx.Customers.Count());
         return(ctx.Customers.Skip(toSkip).Take(1).First());
     }
 }
Exemple #5
0
 public void SetVipCustomer(int id)
 {
     using (var ctx = new TaxiOperatorContext())
     {
         var customer = ctx.Customers.FirstOrDefault(x => x.Id == id);
         customer.IsVip = true;
         customer.Update();
     }
 }