예제 #1
0
        internal Blog EditBlog(Blog editedBlog)
        {
            Blog current = GetOneById(editedBlog.Id);

            if (current == null)
            {
                throw new SystemException("INVALID ID");
            }
            else
            {
                current.Body      = editedBlog.Body != null ? editedBlog.Body : current.Body;
                current.ImgUrl    = editedBlog.ImgUrl != null ? editedBlog.ImgUrl : current.ImgUrl;
                current.Published = editedBlog.Published != true ? editedBlog.Published : current.Published;
                current.Title     = editedBlog.Title != null ? editedBlog.Title : current.Title;
                return(_repo.EditBlog(current));
            }
        }