Exemple #1
0
        // GET: Fates
        public ActionResult Index()
        {
            IEnumerable <Fate> fates = m_repo.GetFates();

            if (fates.IsNullOrEmpty())
            {
                return(RedirectToAction("Create"));
            }

            return(View(fates.ToList()));
        }
Exemple #2
0
        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 }));
        }
Exemple #3
0
        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);
        }