public ResponseMessage Edit(Article entity)
        {
            ResponseMessage response = new ResponseMessage();

            _repository.Edit(entity);

            return(response);
        }
Exemple #2
0
        //public void Appraise(int articleId, AppraiseModel model)
        //{
        //    Article article = articleRepository.Find(articleId);
        //    article.Appraise = new Appraise
        //    {
        //        IsAgree = model.IsAgree,
        //        Voter = GetCurrentUser()
        //    };
        //    article.Agree(article.Appraise.Voter);
        //    articleRepository.Save(article);
        //}
        public void Edit(int id, EditModel model)
        {
            Article article = articleRepository.Find(id);

            mapper.Map <EditModel, Article>(model, article);

            articleRepository.Edit();
        }
Exemple #3
0
        /// <summary>
        ///
        ///     Update
        ///
        ///     Right    = Admin, Instructor
        ///
        ///     Exception     = validation
        ///
        /// </summary>
        public bool Edit(int userId, IArticle article)
        {
            if (!UserLogic.CheckRight(userId, Right.Admin) || UserLogic.CheckRight(userId, Right.Instructor))
            {
                return(false);
            }


            if (!validation(article))
            {
                return(false);
            }


            return(_articleRepository.Edit(article));
        }