Example #1
0
 public ActionResult Edit(BllBlogEntity itemBlog)
 {
     if (itemBlog != null && itemBlog.Name != null)
     {
         var updBlog = _blogService.GetById(itemBlog.Id);
         updBlog.Name = itemBlog.Name;
         _blogService.Update(updBlog);
     }
     return(RedirectToAction("Main"));
 }
Example #2
0
 public ActionResult Create(BllBlogEntity itemBlog)
 {
     if (itemBlog != null && itemBlog.Name.Length > 2)
     {
         var username = Request["user"];
         itemBlog.User = _userService.Contains(username);
         _blogService.Create(itemBlog);
     }
     return(RedirectToAction("Main"));
 }
Example #3
0
        public ActionResult Create(string user)
        {
            BllBlogEntity blog = new BllBlogEntity {
                User = new BllUserEntity {
                    Name = user
                }
            };

            return(PartialView("Create", blog));
        }
Example #4
0
        public bool Update(BllBlogEntity item)
        {
            var blog = _blogRepository.GetById(item.Id);

            if (blog == null)
            {
                return(false);
            }
            _blogRepository.Update(item.ToDal());
            _unitOfWork.Commit();
            return(true);
        }
Example #5
0
        public static DalBlogEntity ToDal(this BllBlogEntity itemBlogEntity)
        {
            if (itemBlogEntity == null)
            {
                return(null);
            }

            return(new DalBlogEntity
            {
                Id = itemBlogEntity.Id,
                Name = itemBlogEntity.Name,
                User = itemBlogEntity.User.ToDal()
            });
        }
Example #6
0
 public void Create(BllBlogEntity blog)
 {
     _blogRepository.Create(blog.ToDal());
     _unitOfWork.Commit();
 }