public BusinessLayerResult <User> RegisterUser(RegisterViewModel model, string Ip)
        {
            //Kullanıcı UserName Kontrolü
            //Kullanıcı E-posta Kontrolü
            //Kayıt İşlemi
            //Aktivasyon E-postası Gönderimi

            BusinessLayerResult <User> LayerResult = new BusinessLayerResult <User>();
            User User = UserRepo.NesneGetirDegereGore(x => x.UserName == model.UserName || x.EMail == model.EMail);

            if (User != null)
            {
                if (User.UserName == model.UserName)
                {
                    LayerResult.Errors.Add("Kullanıcı adı kayıtlı!");
                }
                if (User.EMail == model.EMail)
                {
                    LayerResult.Errors.Add("E-posta adresi kayıtlı!");
                }
            }

            else if (User == null)
            {
                User UserEntity = new User()
                {
                    Name             = model.Name,
                    Surname          = model.Surname,
                    UserName         = model.UserName,
                    EMail            = model.EMail,
                    Password         = model.Password,
                    RePassword       = model.RePassword,
                    ActivateGuid     = Guid.NewGuid(),
                    IsActive         = false,
                    Type             = 2,
                    Ip               = Ip,
                    CreatedUserName  = model.UserName,
                    CreatedDate      = DateTime.Now,
                    ModifiedUserName = model.UserName,
                    ModifiedDate     = DateTime.Now,
                };

                bool dbresult = UserRepo.Kayit(UserEntity);

                if (dbresult)
                {
                    LayerResult.Result = UserRepo.TumListeQueryable().FirstOrDefault(x => x.UserName == model.UserName && x.EMail == model.EMail);
                }
            }

            return(LayerResult);
        }
        public bool Kayit(PostDTO ModelDto)
        {
            Post PostEntity = new Post()
            {
                Title            = ModelDto.TitleDto,
                Content          = ModelDto.ContentDto,
                CreatedUserName  = "******",
                CreatedDate      = ModelDto.CreatedDateDto,
                ModifiedUserName = "******",
                ModifiedDate     = ModelDto.ModifiedDateDto,
                LikeCount        = 15,
                ViewCount        = 20,
                Category         = new Category()
                {
                    Id = ModelDto.CategoryDTO.CategoryDtoId
                },
                User = new User()
                {
                    Id = ModelDto.UserDTO.IdDTO
                }
            };

            return(PostRepo.Kayit(PostEntity));
        }
        public bool Kayit(CategoryDTO ModelDto)
        {
            Category CategoryEntity = new Category()
            {
                Id               = ModelDto.CategoryDtoId,
                Name             = ModelDto.NameCategoryDto,
                SeoCategory      = ModelDto.SeoCategoryDTO,
                Description      = ModelDto.DescriptionCategoryDto,
                CreatedUserName  = ModelDto.CreatedUserNameDto,
                CreatedDate      = ModelDto.CreatedDateDto,
                ModifiedUserName = ModelDto.ModifiedUserNameDto,
                ModifiedDate     = ModelDto.ModifiedDateDto
            };

            return(CategoryRepo.Kayit(CategoryEntity));
        }
        public bool Insert(FileDTO model)
        {
            File FileEntity = new File()
            {
                FileName         = model.FileNameDto,
                FileUrl          = model.FileUrlDto,
                FileSize         = model.FileSizeDto,
                FileExtension    = model.FileExtensionDto,
                FileType         = model.FileTypeDto,
                CreatedUserName  = model.CreatedUserNameDto,
                CreatedDate      = model.CreatedDateDto,
                ModifiedUserName = model.ModifiedUserNameDto,
                ModifiedDate     = model.ModifiedDateDto
            };

            return(RepoFile.Kayit(FileEntity));
        }
示例#5
0
        public bool Insert(ContactDTO model)
        {
            Contact ContactEntity = new Contact()
            {
                Name             = model.NameDTO,
                Surname          = model.SurnameDTO,
                Email            = model.EmailDTO,
                Subject          = model.SubjectDTO,
                Message          = model.MessageDTO,
                CreatedUserName  = model.CreatedUserNameDto,
                CreatedDate      = model.CreatedDateDto,
                ModifiedUserName = model.ModifiedUserNameDto,
                ModifiedDate     = model.ModifiedDateDto
            };

            return(ContactRepo.Kayit(ContactEntity));
        }