public async Task <IActionResult> UpdateWorkshop(long id, UpdateWorkshopCommand command) { command.Id = id; await _workshopService.UpdateWorkshop(command); return(Ok()); }
/// <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>())); }