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 List <PostDTO> PostGetirBaslikIle(string Baslik) { List <Post> PostEntityList = PostRepo.TumListeQueryable().Where(x => x.Title.Contains(Baslik)).ToList(); List <PostDTO> PostDtoList = new List <PostDTO>(); foreach (Post PostEntity in PostEntityList) { PostDTO PostDTO = new PostDTO() { PostDtoId = PostEntity.Id, TitleDto = PostEntity.Title, ContentDto = PostEntity.Content, SeolinkDto = PostEntity.Seolink, ViewCountDto = PostEntity.ViewCount.Value, CreatedUserNameDto = PostEntity.CreatedUserName, CreatedDateDto = PostEntity.CreatedDate.Value, ModifiedUserNameDto = PostEntity.ModifiedUserName, ModifiedDateDto = PostEntity.ModifiedDate.Value, CategoryDTO = new CategoryDTO() { CategoryDtoId = PostEntity.Category.Id, NameCategoryDto = PostEntity.Category.Name, DescriptionCategoryDto = PostEntity.Category.Description }, UserDTO = new UserDTO() { NameDTO = PostEntity.User.Name, SurnameDTO = PostEntity.User.Surname, CreatedDateDto = PostEntity.CreatedDate.Value } }; PostDtoList.Add(PostDTO); } return(PostDtoList); }