예제 #1
0
        public static UserUpload AddUserUpload(UserUpload userUpload)
        {
            UserUpload retUserUpload = null;

            try
            {
                using (ImgurPlusContext dbContext = new ImgurPlusContext())
                {
                    retUserUpload = dbContext.UserUploads.Add(userUpload).Entity;
                    dbContext.SaveChanges();
                }
            }
            catch (Exception ex) { return(null); }
            return(retUserUpload);
        }
예제 #2
0
        public static User AddUser(User user)
        {
            User retUser = null;

            try
            {
                using (ImgurPlusContext dbContext = new ImgurPlusContext())
                {
                    retUser = dbContext.Users.Add(user).Entity;
                    dbContext.SaveChanges();
                }
            }
            catch (Exception ex) { return(null); }
            return(retUser);
        }
예제 #3
0
        public static int DeteleUserUpload(Expression <Func <UserUpload, bool> > searchFunc)
        {
            int retUserUpload = 0;

            try
            {
                using (ImgurPlusContext dbContext = new ImgurPlusContext())
                {
                    UserUpload userUpd = GetUserUpload(searchFunc);
                    userUpd.DeleteDate = DateTimeOffset.Now;
                    dbContext.UserUploads.Update(userUpd);
                    retUserUpload = dbContext.SaveChanges();
                }
            }
            catch { return(0); }
            return(retUserUpload);
        }