Example #1
0
        /// <inheritdoc/>
        public Task UpdateWorkshop(UpdateWorkshopCommand command)
        {
            Workshop workshop = _repository.GetWorkshop(command.Id);

            if (workshop == null)
            {
                throw new NotFoundException();
            }
            else if (workshop.CreatedBy != _userInfo.UserId && !_userInfo.IsAdmin)
            {
                throw new ResourceIsForbiddenException();
            }

            return(_repository.EditWorkshop(command.Adapt <Workshop>()));
        }