public static int Create(List <OrderDetailsView> list) { try { db = new AceEntities(); List <OrderDetails> listDT = new List <OrderDetails>(); foreach (OrderDetailsView item in list) { listDT.Add(new OrderDetails { Date = item.Date, OrderId = item.OrdID, Price = item.Price, Quantity = item.Quantity, ServicesId = item.SvID }); } db.OrderDetails.AddRange(listDT); db.SaveChanges(); return(list[0].OrdID); } catch { return(-1); } }
public static bool Remove(int id) { try { db = new AceEntities(); db.Account.Remove(db.Account.Find(id)); db.SaveChanges(); return(true); } catch { return(false); } }
public static int Create(AccountView acc) { db = new AceEntities(); Account account = new Account { Name = acc.Name, Email = acc.Email, Address = acc.Address, Password = acc.Password, Phone = acc.Phone, Roles = acc.Role }; db.Account.Add(account); db.SaveChanges(); return(account.Id); }
public static int Create(ServicesView s) { try { db = new AceEntities(); Services services = new Services { Name = s.Name, Price = s.Price }; db.Services.Add(services); db.SaveChanges(); return(services.Id); } catch { return(-1); } }
public static bool Update(BookingView b) { try { db = new AceEntities(); Booking book = db.Booking.Find(b.Id); book.IdCustomer = b.CusID; book.RoomId = b.RoomID; book.Status = b.Status; book.DateEnd = b.DateEnd; book.DateStart = b.DateStart; db.SaveChanges(); return(true); } catch { return(false); } }
public static int Create(RoomView r) { try { db = new AceEntities(); Room room = new Room { IdEmp = r.EmpID, Name = Convert.ToInt32(r.Name.Trim()), Price = r.Price, }; db.SaveChanges(); return(room.Id); } catch { return(-1); } }
public static bool Modify(ServicesView s) { try { db = new AceEntities(); Services services = new Services { Name = s.Name, Price = s.Price }; db.Services.Attach(services); db.Entry(services).State = EntityState.Modified; db.SaveChanges(); return(true); } catch { return(false); } }
public static int Create(BookingView b) { try { Booking book = new Booking { DateEnd = b.DateEnd, DateStart = b.DateStart, IdCustomer = b.CusID, RoomId = b.RoomID, Status = b.Status }; db.Booking.Add(book); db.SaveChanges(); return(book.Id); } catch { return(-1); } }
public static bool Modify(RoomView r) { try { db = new AceEntities(); Room room = new Room { IdEmp = r.EmpID, Name = Convert.ToInt32(r.Name.Trim()), Price = r.Price, }; db.Room.Attach(room); db.Entry(room).State = EntityState.Modified; db.SaveChanges(); return(true); } catch { return(false); } }
public static bool Modify(AccountView acc) { try { db = new AceEntities(); Account account = new Account { Name = acc.Name, Email = acc.Email, Address = acc.Address, Password = acc.Password, Phone = acc.Phone, Roles = acc.Role }; db.Account.Attach(account); db.Entry(account).State = EntityState.Modified; db.SaveChanges(); return(true); } catch { return(false); } }
public static int Create(OrderView o) { try { db = new AceEntities(); Orders orders = new Orders { Date = o.Date, DateEnd = o.DateEnd, DateStart = o.DateStart, IdCus = o.CusID, IdEmp = o.EmpID, IdRoom = o.RoomID, Total = o.Total }; db.Orders.Add(orders); db.SaveChanges(); return(orders.Id); } catch { return(-1); } }