Beispiel #1
0
        public async Task <IActionResult> Delete(string Id)
        {
            var inst = (from i in DBContext.Institutions
                        where i.Id.ToString() == Id
                        select i).FirstOrDefaultAsync().Result;

            DBContext.Remove(inst);
            // DBContext.Institutions.Find(inst).En
            await DBContext.SaveChangesAsync();

            DisciplineFilesChecker checker = new DisciplineFilesChecker();

            checker.Check(environment, DBContext);
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
        public async Task <IActionResult> Delete(string Id)
        {
            var spec = await(from d in DBContext.Specialities where d.Id.ToString() == Id select d).FirstOrDefaultAsync();

            if (spec != null)
            {
                var dep = await(from i in DBContext.Departments.Include(d => d.Specialities)
                                where i.Specialities.Contains(spec)
                                select i).FirstOrDefaultAsync();
                DBContext.Remove(spec);
                await DBContext.SaveChangesAsync();

                DisciplineFilesChecker checker = new DisciplineFilesChecker();
                checker.Check(environment, DBContext);
                return(RedirectToAction("Index", new { DepId = dep.Id }));
            }
            return(RedirectToAction("Index", "Home"));
        }