public void Insert(Order order) { using (ShoeDao db = new ShoeDao()) { db.Orders.Add(order); db.SaveChanges(); } }
public long Insert(User entity) { using (ShoeDao db = new ShoeDao()) { db.Users.Add(entity); db.SaveChanges(); return(entity.ID); } }
public int Insert(OrderDetail order) { using (ShoeDao db = new ShoeDao()) { db.OrderDetails.Add(order); db.SaveChanges(); return(order.ID); } }
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); } } }
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); } } }