public void CheckSummitBadge(BadgeSummit badge) { if (badge.UnreachedSummits != null) { repository.UpdateBadgeStatus(badge.Id, "Achieved"); } }
public async Task <IActionResult> PostAsync([FromBody] BadgeSummit badge) { logger.LogInformation("Adding new summit badge was called"); try { if (ModelState.IsValid) { badge.BadgeStatus = "Inactive"; await repository.AddBadge(badge); if (await repository.SaveAll()) { return(Created("api/badges", badge)); } } } catch (Exception ex) { logger.LogError($"Failed to add new summit badge: {ex}"); } return(BadRequest("Failed to add new summit badge")); }