/// <summary> /// Selects crime information from the underlying data source. /// </summary> /// <param name="id">The ID of the associated crime information.</param> /// <returns>Returns a Crime object representing the result of the operation.</returns> public CrimeOffenceLocalGovernmentAreaState GetCrimeOffenceLocalGovernmentAreaStateByID(int id) { CrimeOffenceLocalGovernmentAreaState crimeOffenceLocalGovernmentAreaState = null; using (SqlConnection sqlConnection = SqlConnectionFactory.NewSqlConnetion()) { crimeOffenceLocalGovernmentAreaState = SqlMapper .Query(sqlConnection, CrimeSpGetCrimeOffenceLocalGovernmentAreaStateByID, new { ID = id }, commandType: CommandType.StoredProcedure) .Select(m => new CrimeOffenceLocalGovernmentAreaState ( m.Count, m.DateCreatedUtc, m.DateUpdatedUtc, m.ID, m.IsDeleted, m.IsVisible, m.LocalGovernmentAreaID, m.LocalGovernmentAreaName, m.Month, m.OffenceID, m.OffenceName, m.StateID, m.StateName, m.Year )) .FirstOrDefault(); } return(crimeOffenceLocalGovernmentAreaState); }
public ActionResult Crime(uint id) { CrimeModel crimeModel = null; CrimeOffenceLocalGovernmentAreaState crimeOffenceLocalGovernmentAreaState = DataProvider.CrimeOffenceLocalGovernmentAreaStateRepository.GetCrimeOffenceLocalGovernmentAreaStateByID((int)(id)); if (crimeOffenceLocalGovernmentAreaState != null) { crimeModel = new CrimeModel ( crimeOffenceLocalGovernmentAreaState.Count, crimeOffenceLocalGovernmentAreaState.DateCreatedUtc, crimeOffenceLocalGovernmentAreaState.DateUpdatedUtc, crimeOffenceLocalGovernmentAreaState.ID, crimeOffenceLocalGovernmentAreaState.IsDeleted, crimeOffenceLocalGovernmentAreaState.IsVisible, crimeOffenceLocalGovernmentAreaState.LocalGovernmentAreaID, crimeOffenceLocalGovernmentAreaState.Month, crimeOffenceLocalGovernmentAreaState.OffenceID, crimeOffenceLocalGovernmentAreaState.Year ); } return(View(crimeModel)); }