Exemplo n.º 1
0
        public static EducationLevelModel EducationLevelToEducationLevelModel(EducationLevel model)
        {
            var educationLevelModel = new EducationLevelModel
            {
                Id           = model.Id,
                DisplayOrder = model.DisplayOrder,
                IsActive     = model.IsActive,
                LevelName    = model.LevelName
            };

            return(educationLevelModel);
        }
Exemplo n.º 2
0
        private static EducationLevelModel PrepareEducationLevelModel(EducationLevel educationLevel)
        {
            EducationLevelModel educationLevelTemp = new EducationLevelModel();

            educationLevelTemp.Id   = educationLevel.Id;
            educationLevelTemp.Name = educationLevel.Name;
            if (educationLevel.IsActive != null)
            {
                educationLevelTemp.IsActive = educationLevel.IsActive.Value;
            }
            return(educationLevelTemp);
        }
Exemplo n.º 3
0
        public async Task <EducationLevelModel[]> GetAllEducationLevels()
        {
            EducationLevelModel[] educationLevels;

            using (var imisContext = new ImisDB())
            {
                educationLevels = await imisContext.TblEducations
                                  .Select(e => EducationLevelModel.FromTblEducations(e))
                                  .ToArrayAsync();
            }

            return(educationLevels);
        }
Exemplo n.º 4
0
        public ActionResult Create(EducationLevelModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    educationService.Add(model);

                    TempData["Success"] = $"{model.LevelName} Added !";

                    return(RedirectToAction("Index"));
                }
                return(View(@"~\Views\Configuration\Education\Create.cshtml", model));
            }
            catch (Exception e)
            {
                TempData["Danger"] = $"Opps something went wrong {e.Message}";

                throw;
            }
        }