예제 #1
0
 //xử lý
 public bool Insert(OrderDetail entity)
 {
     try
     {
         db.OrderDetails.Add(entity);
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
예제 #2
0
 public bool Insert(About entity)
 {
     db.Abouts.Add(entity);
     db.SaveChanges();
     return(true);
 }
예제 #3
0
        //public IEnumerable<UserViewModel> List(string searchString, int page, int pagesize)
        //{

        //    var query = (from u in db.Users
        //                 join g in db.UserGroups
        //                 on u.UserGroupID equals g.UserGroupID
        //                 select new
        //                 {
        //                     UserID = u.UserID,
        //                     UserName = u.UserName,
        //                     Password = u.Password,
        //                     FullName = u.FullName,
        //                     Birthday = u.Birthday,
        //                     Gender = u.Gender,
        //                     Address = u.Address,
        //                     Email = u.Email,
        //                     Phone = u.Phone,
        //                     CreatedDate = u.CreatedDate,
        //                     Status = u.Status,
        //                     UserGroupID = u.UserGroupID,
        //                     UserGroupName = g.Name

        //                 }).AsEnumerable().Select(x => new UserViewModel()
        //                 {

        //                     UserID = x.UserID,
        //                     UserName = x.UserName,
        //                     Password = x.Password,
        //                     FullName = x.FullName,
        //                     Birthday = x.Birthday,
        //                     Gender = x.Gender,
        //                     Address = x.Address,
        //                     Email = x.Email,
        //                     Phone = x.Phone,
        //                     Status = x.Status,
        //                     UserGroupID = x.UserGroupID,
        //                     UserGroupName = x.UserGroupName
        //                 });
        //    if (!string.IsNullOrEmpty(searchString))
        //    {
        //        query = query.Where(x => x.UserName.Contains(searchString) || x.FullName.Contains(searchString));
        //    }
        //    query.OrderBy(x => x.UserID).ToPagedList(page, pagesize);
        //    return query.ToList();
        //}

        public long Insert(User entity)
        {
            db.Users.Add(entity);
            db.SaveChanges();
            return(entity.ID);
        }
예제 #4
0
 /// <summary>
 /// Các hàm xử lý
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public long Insert(ProductCategory entity)
 {
     db.ProductCategories.Add(entity);
     db.SaveChanges();
     return(entity.ID);
 }
예제 #5
0
 public bool Insert(UserGroup entity)
 {
     db.UserGroups.Add(entity);
     db.SaveChanges();
     return(true);
 }
예제 #6
0
 public bool Insert(Contact entity)
 {
     db.Contacts.Add(entity);
     db.SaveChanges();
     return(true);
 }
예제 #7
0
 //xử lý
 public long Insert(Menu entity)
 {
     db.Menus.Add(entity);
     db.SaveChanges();
     return(entity.ID);
 }
예제 #8
0
 //Xử lý
 public long Insert(Slide entity)
 {
     db.Slides.Add(entity);
     db.SaveChanges();
     return(entity.ID);
 }
예제 #9
0
 public int Insert(MenuType entity)
 {
     db.MenuTypes.Add(entity);
     db.SaveChanges();
     return(entity.ID);
 }
예제 #10
0
 public bool Insert(Feedback entity)
 {
     db.Feedbacks.Add(entity);
     db.SaveChanges();
     return(true);
 }
예제 #11
0
 public bool Insert(Footer entity)
 {
     db.Footers.Add(entity);
     db.SaveChanges();
     return(true);
 }
예제 #12
0
 public bool Insert(Role entity)
 {
     db.Roles.Add(entity);
     db.SaveChanges();
     return(true);
 }
예제 #13
0
 //Xử lý
 public long Insert(Product entity)
 {
     db.Products.Add(entity);
     db.SaveChanges();
     return(entity.ID);
 }