示例#1
0
 public long Insert(About about)
 {
     about.CreatedDate = DateTime.Now;
     db.Abouts.Add(about);
     db.SaveChanges();
     return(about.ID);
 }
示例#2
0
        public void insert(Beacon beacon)
        {
            Random random = new Random();

            beacon.MACID = random.Next(1, 1000);
            context.Beacons.Add(beacon);
            context.SaveChanges();
        }
示例#3
0
        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();
        }
示例#4
0
        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();
        }
示例#5
0
 public bool Insert(OrderDetail detail)
 {
     try
     {
         db.OrderDetails.Add(detail);
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
示例#6
0
 public void Insert(Category category)
 {
     category.CreatedDate = DateTime.Now;
     db.Categories.Add(category);
     db.SaveChanges();
 }
示例#7
0
 public int InsertFeedBack(Feedback fb)
 {
     context.Feedbacks.Add(fb);
     context.SaveChanges();
     return(fb.ID);
 }
示例#8
0
 public long Insert(User entity)
 {
     db.Users.Add(entity);
     db.SaveChanges();
     return(entity.ID);
 }
示例#9
0
 //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);
 }
示例#10
0
 public void Add(Shop shop)
 {
     db.Shops.Add(shop);
     db.SaveChanges();
 }
示例#11
0
 public long Insert(Menu menu)
 {
     db.Menus.Add(menu);
     db.SaveChanges();
     return(menu.ID);
 }
示例#12
0
 public string Insert(Footer entity)
 {
     context.Footers.Add(entity);
     context.SaveChanges();
     return(entity.ID);
 }
示例#13
0
 public int Insert(MenuType entity)
 {
     context.MenuTypes.Add(entity);
     context.SaveChanges();
     return(entity.ID);
 }
示例#14
0
 public void Add(Product product)
 {
     db.Products.Add(product);
     db.SaveChanges();
 }
示例#15
0
 public int Insert(Banner banner)
 {
     db.Banners.Add(banner);
     db.SaveChanges();
     return(banner.ID);
 }