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")); }
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")); }
public ActionResult Create(string user) { BllBlogEntity blog = new BllBlogEntity { User = new BllUserEntity { Name = user } }; return(PartialView("Create", blog)); }
public bool Update(BllBlogEntity item) { var blog = _blogRepository.GetById(item.Id); if (blog == null) { return(false); } _blogRepository.Update(item.ToDal()); _unitOfWork.Commit(); return(true); }
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() }); }
public void Create(BllBlogEntity blog) { _blogRepository.Create(blog.ToDal()); _unitOfWork.Commit(); }