// GET: Fates public ActionResult Index() { IEnumerable <Fate> fates = m_repo.GetFates(); if (fates.IsNullOrEmpty()) { return(RedirectToAction("Create")); } return(View(fates.ToList())); }
public JsonResult SaveFatesJson(int mcrId, int[] fates) { IEnumerable <Fate> fatesToUpdate = null; if (fates != null) { fatesToUpdate = m_repo.GetFates().Where(f => fates.Any(i => i == f.Id)); } m_repo.UpdateMapComponentFates(fatesToUpdate, mcrId); return(Json(new { Error = false })); }
public PhenotypeEntryViewModel GetPhenotypeEntryVM(int id, string year) { Map map = u_repo.GetMap(id); List <Fate> possibleFates = u_repo.GetFates().OrderBy(t => t.Order).ToList(); Years mapYear; if (year.IsNullOrWhiteSpace()) { mapYear = map.Years.OrderByDescending(t => t.Year).FirstOrDefault(); } else { mapYear = map.Years.SingleOrDefault(t => t.Year == year); } if (mapYear == null || mapYear.Id <= 0) { throw new PhenotypeException(Properties.Settings.Default.ExceptionPhenotypeInvalidYear); } PhenotypeEntryViewModel vm = GetPhenotypeEntryVM(map, possibleFates, mapYear.Id); return(vm); }