internal PostResult MakeNewReply(NewPost post, HttpPostedFileBase postFile, string shortName, string IPAddress) { bool imageExists = postFile != null; bool imageIsGood = !imageExists || ImageGood(postFile, shortName); string ip = IPAddress; DateTime cur = DateTime.UtcNow; bool isParentValid = db.Posts.Where(p => p.ID == post.resto) .Count() > 0; if (imageIsGood && isParentValid) { double iCur = DateService.DateTimeToUnixTimestamp(cur); if (imageExists) { SaveFileToBoardFolder(shortName, postFile, iCur, postFile.FileName); saveSmallFileToBoardFolder(shortName, postFile, iCur, postFile.FileName); int fsize = postFile.ContentLength; } savePostToDatabase(post, postFile, shortName, cur); return(PostResult.NewReplyCreated); } return(PostResult.PostFailure); }
internal PostResult MakeNewThread(NewPost post, HttpPostedFileBase postFile, string shortName, string IPAddress) { bool imageExists = postFile != null; if (!imageExists) { return(PostResult.PostFailure); } bool imageIsGood = ImageGood(postFile, shortName); string ip = IPAddress; DateTime cur = DateTime.UtcNow; if (imageIsGood) { double iCur = DateService.DateTimeToUnixTimestamp(cur); SaveFileToBoardFolder(shortName, postFile, iCur, postFile.FileName); saveSmallFileToBoardFolder(shortName, postFile, iCur, postFile.FileName); int fsize = postFile.ContentLength; savePostToDatabase(post, postFile, shortName, cur); return(PostResult.NewThreadCreated); } return(PostResult.PostFailure); }