Пример #1
0
        public IExecutionResult Update(ArticleModifyViewModel model, string currentLoggedUserId)
        {
            if (model.AuthorId == currentLoggedUserId)
            {
                return(base.Update(model));
            }

            return(new ExecutionResult()
            {
                Succeded = false,
                Message = GlobalMessages.NoAccess("article")
            });
        }
Пример #2
0
        public IExecutionResult Delete(int id, string currentLoggedUserId)
        {
            var repo = unitOfWork.GetRepository <Article>();
            var item = repo.FirstOrDefault(i => i.Id == id);

            if (item.AuthorId == currentLoggedUserId)
            {
                return(base.Delete(item));
            }

            return(new ExecutionResult()
            {
                Succeded = false,
                Message = GlobalMessages.NoAccess("article")
            });
        }