public async Task <IActionResult> Put(string name, [FromBody] UpdateAchievementRequest request) { var achievement = await _repository.GetEntity("1", name); if (achievement == null) { return(BadRequest("There is no achievement matching that name")); } achievement.Category = request.Category; achievement.Description = request.Details; achievement.IsSecret = request.IsSecret; await _repository.InsertOrMergeEntity(achievement); return(NoContent()); }
public async Task <IActionResult> Put(int id, [FromBody] UpdateAchievementRequest request) { var achievement = new Achievement { Id = id, Category = new Category { Id = request.CategoryId }, Name = request.Name, Details = request.Details, IsSecret = request.IsSecret }; await _repository.Update(achievement); return(NoContent()); }