public void Update(GenreBL genre)
        {
            var item = AutoMapperBL <GenreBL, Genre> .Map(genre);

            Dbcontext.UowRepositoryGenres.Update(item);
            Dbcontext.Save();
        }
        public bool Create(UserBL user)
        {
            if (null == user)
            {
                return(false);
            }
            if (null != Dbcontext.UowRepositoryUsers.Find(q => q.Login == user.Login))
            {
                return(false);
            }

            var item = new User()
            {
                Login = user.Login, Email = user.Email, Password = user.Password
            };

            Dbcontext.UowRepositoryUsers.Create(item);
            try
            {
                Dbcontext.Save();
            }
            catch (System.Exception)
            {
                return(false);
            }

            return(true);
        }
예제 #3
0
 public void DeleteWork(int id)
 {
     if (0 >= id)
     {
         return;
     }
     Dbcontext.UowRepositoryWorks.Delete(id);
     Dbcontext.Save();
 }
        public void DeleteUser(int id)
        {
            if (0 >= id)
            {
                return;
            }

            Dbcontext.UowRepositoryUsers.Delete(id);
            Dbcontext.Save();
        }
        public void DeleteRating(int id)
        {
            if (0 >= id)
            {
                return;
            }

            Dbcontext.UowRepositoryRatings.Delete(id);
            Dbcontext.Save();
        }
        public void DeleteGenre(int id)
        {
            if (0 >= id)
            {
                return;
            }

            Dbcontext.UowRepositoryGenres.Delete(id);
            Dbcontext.Save();
        }
예제 #7
0
        public void DeleteComment(int id)
        {
            if (0 >= id)
            {
                return;
            }

            Dbcontext.UowRepositoryComments.Delete(id);
            Dbcontext.Save();
        }
        public void Update(RatingBL rating)
        {
            if (null == rating)
            {
                return;
            }

            var item = AutoMapperBL <RatingBL, Rating> .Map(rating);

            Dbcontext.UowRepositoryRatings.Update(item);
            Dbcontext.Save();
        }
예제 #9
0
        public void Update(WorkBL work)
        {
            if (null == work)
            {
                return;
            }

            var item = AutoMapperBL <WorkBL, Work> .Map(work);

            Dbcontext.UowRepositoryWorks.Update(item);
            Dbcontext.Save();
        }
예제 #10
0
        public void Update(CommentBL comment)
        {
            if (null == comment)
            {
                return;
            }

            var item = AutoMapperBL <CommentBL, Comment> .Map(comment);

            Dbcontext.UowRepositoryComments.Update(item);
            Dbcontext.Save();
        }
        public void Create(RatingBL rating)
        {
            if (null == rating)
            {
                return;
            }

            var item = new Rating()
            {
                Rank = rating.Rank, UserId = rating.UserId, WorkId = rating.WorkId
            };

            Dbcontext.UowRepositoryRatings.Create(item);
            Dbcontext.Save();
        }
        public void Create(GenreBL genre)
        {
            if (null == genre)
            {
                return;
            }

            var item = new Genre()
            {
                Name = genre.Name
            };

            Dbcontext.UowRepositoryGenres.Create(item);
            Dbcontext.Save();
        }
예제 #13
0
        public void Create(WorkBL work)
        {
            if (null == work)
            {
                return;
            }

            var item = new Work()
            {
                Title = work.Title, DateOfPublication = work.DateOfPublication, Content = work.Content, GenreId = work.GenreId, UserId = work.UserId
            };

            Dbcontext.UowRepositoryWorks.Create(item);
            Dbcontext.Save();
        }
예제 #14
0
        public void Create(CommentBL comment)
        {
            if (null == comment)
            {
                return;
            }

            var item = new Comment()
            {
                Body = comment.Comment, UserId = comment.UserId, WorkId = comment.WorkId
            };

            Dbcontext.UowRepositoryComments.Create(item);
            Dbcontext.Save();
        }