public long Insert(About about) { about.CreatedDate = DateTime.Now; db.Abouts.Add(about); db.SaveChanges(); return(about.ID); }
public void insert(Beacon beacon) { Random random = new Random(); beacon.MACID = random.Next(1, 1000); context.Beacons.Add(beacon); context.SaveChanges(); }
public void UpdatePermissionUser(string lstRoleSelected, int userId) { string[] arrRole = lstRoleSelected.Split('*'); IEnumerable <User_Permission> lstUserPermission = db.User_Permission.Where(x => x.UserID == userId); db.User_Permission.RemoveRange(lstUserPermission); db.SaveChanges(); for (int i = 0; i < arrRole.Length; i++) { if (arrRole[i].Length > 0) { User_Permission up = new User_Permission(); up.UserID = userId; up.RoleId = arrRole[i]; db.User_Permission.Add(up); } } db.SaveChanges(); }
public void UpdatePermissionGroup(string lstRoleSelected, int groupId) { string[] arrRole = lstRoleSelected.Split('*'); IEnumerable <Group_Permission> lstGroupPermission = db.Group_Permission.Where(x => x.GroupId == groupId); db.Group_Permission.RemoveRange(lstGroupPermission); db.SaveChanges(); for (int i = 0; i < arrRole.Length; i++) { if (arrRole[i].Length > 0) { Group_Permission gp = new Group_Permission(); gp.GroupId = groupId; gp.RoleId = arrRole[i]; db.Group_Permission.Add(gp); } } db.SaveChanges(); }
public bool Insert(OrderDetail detail) { try { db.OrderDetails.Add(detail); db.SaveChanges(); return(true); } catch { return(false); } }
public void Insert(Category category) { category.CreatedDate = DateTime.Now; db.Categories.Add(category); db.SaveChanges(); }
public int InsertFeedBack(Feedback fb) { context.Feedbacks.Add(fb); context.SaveChanges(); return(fb.ID); }
public long Insert(User entity) { db.Users.Add(entity); db.SaveChanges(); return(entity.ID); }
//else if(checkOrder==true) //{ // if (!String.IsNullOrEmpty(searchString)) // { // model = model.Where(x => x.NameCustomer.Contains(searchString) && x.Status==true); // } // return model.OrderByDescending(x => x.ID).ToPagedList(page, pagesize); //} //else //{ // if (!String.IsNullOrEmpty(searchString)) // { // model = model.Where(x => x.NameCustomer.Contains(searchString) && x.Status == false); // } // return model.OrderByDescending(x => x.ID).ToPagedList(page, pagesize); //} public long Insert(Order order) { db.Orders.Add(order); db.SaveChanges(); return(order.ID); }
public void Add(Shop shop) { db.Shops.Add(shop); db.SaveChanges(); }
public long Insert(Menu menu) { db.Menus.Add(menu); db.SaveChanges(); return(menu.ID); }
public string Insert(Footer entity) { context.Footers.Add(entity); context.SaveChanges(); return(entity.ID); }
public int Insert(MenuType entity) { context.MenuTypes.Add(entity); context.SaveChanges(); return(entity.ID); }
public void Add(Product product) { db.Products.Add(product); db.SaveChanges(); }
public int Insert(Banner banner) { db.Banners.Add(banner); db.SaveChanges(); return(banner.ID); }