public ActionResult AddDisaster(DisasterDetailsviewModel model) { var disaster = new Data.Models.DisasterDetails { Name = model.Name, Description = model.Details, DisasterId = model.DisasterId, CreatedDate = DateTime.Now, IsActive = true, StartDate = model.StartDate, }; ddRepo.Insert(disaster); var effectedCiteis = (from item in model.EffectedStates select new EffectedCities { DisasterDetailsId = disaster.Id, Stateid = item }).ToList(); ecRepos.InsertMany(effectedCiteis); RedirectToActionPermanent("AddDisaster"); return(View(model)); }
public ActionResult AddDisaster() { DisasterDetailsviewModel model = new DisasterDetailsviewModel(); model.States = GetAllMasterDetails().City.State; model.Disasters = (from item in disasterRepo.FilteredGet() select new AddressViewModel { Id = item.Id, Name = item.Name }).ToList(); return(View(model)); }