public ActionResult <Color> Get(int id) { james.Db.Color dbColor = _repository.Get(id); if (dbColor == null) { return(NotFound( new NoColor { Message = $"Color '{id}' no trobat" })); } var src = new Color { Nom = dbColor.Nom, Rgb = dbColor.Rgb }; return(Ok(src)); }
public async Task <IActionResult> Get(string nom) { james.Db.Color dbColor = await _repository.Get(nom); if (dbColor == null) { return(NotFound( new NoColor { Message = $"Color '{nom}' no trobat" })); } var src = new Color { Nom = dbColor.Nom, Rgb = dbColor.Rgb }; return(Ok(src)); }