public ActionResult AddEditStation(long?stationId, string copyInd) { var viewModel = new AddEditStationViewModel(); if (stationId.HasValue) { var drStation = CRCDataAccess.GetStation(stationId.Value); drStation.MapTo(viewModel); viewModel.EnabledInd = !(drStation["DisabledDate"] is DateTime); viewModel.CopyInd = copyInd.Equals("Y", StringComparison.OrdinalIgnoreCase) ? "Y" : "N"; using (var dtStationAffiliates = CRCDataAccess.GetStationAffiliates(stationId.Value)) { viewModel.AffiliateIds = dtStationAffiliates.AsEnumerable().Select(row => (long)row["AffiliateId"]); } } else { //Set default values when adding a new station viewModel.EnabledInd = true; viewModel.MemberStatusId = InfLookupHelper.ReverseLookup("MemberStatus", "MemberStatusName", "Full"); viewModel.MinorityStatusId = InfLookupHelper.ReverseLookup("MinorityStatus", "MinorityStatusName", "None"); viewModel.StatusDate = DateTime.UtcNow.AddHours(InfDate.GetUtcOffSet); //viewModel.TimeZoneId = InfLookupHelper.ReverseLookup("TimeZone", "TimeZoneCode", "Eastern Standard Time"); viewModel.MaxNumberOfUsers = 4; } return(View(viewModel)); }