Example #1
0
 public void Insert(Order order)
 {
     using (ShoeDao db = new ShoeDao())
     {
         db.Orders.Add(order);
         db.SaveChanges();
     }
 }
Example #2
0
 public long Insert(User entity)
 {
     using (ShoeDao db = new ShoeDao())
     {
         db.Users.Add(entity);
         db.SaveChanges();
         return(entity.ID);
     }
 }
Example #3
0
 public int Insert(OrderDetail order)
 {
     using (ShoeDao db = new ShoeDao())
     {
         db.OrderDetails.Add(order);
         db.SaveChanges();
         return(order.ID);
     }
 }
Example #4
0
 public bool Delete(int id)
 {
     using (ShoeDao db = new ShoeDao())
     {
         try
         {
             var user = db.Users.Find(id);
             db.Users.Remove(user);
             db.SaveChanges();
             return(true);
         }
         catch (Exception ex)
         {
             return(false);
         }
     }
 }
Example #5
0
        public bool Update(User entity)
        {
            using (ShoeDao db = new ShoeDao())
            {
                try
                {
                    var user = db.Users.Find(entity.ID);
                    user.Name         = entity.Name;
                    user.Address      = entity.Address;
                    user.Email        = entity.Email;
                    user.ModifiedBy   = entity.ModifiedBy;
                    user.ModifiedDate = DateTime.Now;
                    user.Password     = entity.Password;

                    db.SaveChanges();
                    return(true);
                }
                catch (Exception ex)
                {
                    return(false);
                }
            }
        }