public Material Get(int id) { string query = string.Format("SELECT * FROM test.materials WHERE Id={0}", id); using (MySqlDataReader reader = DatabaseConnector.ExecuteSql(query)) { if (reader.Read() && reader.HasRows) { Material material = new Material(reader); material.MeasureUnit = measureUnitRepository.Get(material.MeasureUnitId); return(material); } return(null); } }
// GET: MeasureUnits/Details/5 public IActionResult Details(int?id) { if (id == null) { return(NotFound()); } var measureUnit = measureUnitsRepository.Get(id.Value); if (measureUnit == null) { return(NotFound()); } return(View(measureUnit)); }