// // GET: /SysAdmin/State/Details/5 public ActionResult Details(int id) { StateVM viewModel = new StateVM(); StateBAL balObject = new StateBAL(); IQueryable <Entities.State> entites = balObject.FindBy(a => a.StateId == id); if (entites != null && entites.Count() > 0) { Entities.State entity = entites.FirstOrDefault(); viewModel.StateId = entity.StateId; viewModel.StateName = entity.StateName; CountryBAL countryBAL = new CountryBAL(); viewModel.CountryName = countryBAL.FindBy(c => c.CountryId == entity.CountryId).FirstOrDefault().CountryName; viewModel.Status = entity.Status; viewModel.Remark = entity.Remark; } return(View(viewModel)); }
public ActionResult Edit(StateVM viewModel) { try { // TODO: Add update logic here if (ModelState.IsValid) { Entities.State entity = new Entities.State(); entity.StateId = viewModel.StateId; entity.CountryId = viewModel.CountryId; entity.StateName = viewModel.StateName; entity.Status = viewModel.Status; entity.Remark = viewModel.Remark; StateBAL balObject = new StateBAL(); balObject.Edit(entity); return(RedirectToAction("Index")); } else { //AcademicYearBAL academicYearBAL = new AcademicYearBAL(); //viewModel.AcademicYears = from obj in academicYearBAL.GetAll() select new SelectListItem() { Text = obj.AcademicYearName, Value = obj.AcademicYearId.ToString() }; CountryBAL countryBAL = new CountryBAL(); viewModel.Countries = from obj in countryBAL.GetAll() select new SelectListItem() { Text = obj.CountryName, Value = obj.CountryId.ToString() }; return(View(viewModel)); } } catch { //AcademicYearBAL academicYearBAL = new AcademicYearBAL(); //viewModel.AcademicYears = from obj in academicYearBAL.GetAll() select new SelectListItem() { Text = obj.AcademicYearName, Value = obj.AcademicYearId.ToString() }; CountryBAL countryBAL = new CountryBAL(); viewModel.Countries = from obj in countryBAL.GetAll() select new SelectListItem() { Text = obj.CountryName, Value = obj.CountryId.ToString() }; return(View()); } }
public List <Entities.State> GetStatesByCountry(Int32 countryId) { var states = new List <Entities.State>(); DbCommand dbCommand = null; try { using (dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetListOfStatesByCountryId)) { database.AddInParameter(dbCommand, "@country_id", DbType.Int32, countryId); using (IDataReader reader = database.ExecuteReader(dbCommand)) { while (reader.Read()) { var state = new Entities.State { StateId = DRE.GetNullableInt32(reader, "state_id", 0), StateName = DRE.GetNullableString(reader, "state_name", null), StateCode = DRE.GetNullableString(reader, "state_code", null), TINNo = DRE.GetNullableString(reader, "tin_no", null) }; states.Add(state); } } } } catch (Exception ex) { throw ex; } finally { dbCommand = null; } return(states); }
public async Task IsOpenWindowDetectedTest() { Entities.State response = await session.GetZoneState(HomeId, ZoneId); Assert.IsInstanceOfType(response.OpenWindowDetected, typeof(bool)); }
public StateModel(Entities.State state) { this.Id = state.Id; this.Abbreviation = state.Abbreviation; }