Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("HarvestPlanId,Name,DepatmentId,TeacherId,GrupId")] HarvestPlan harvestPlan)
        {
            if (id != harvestPlan.HarvestPlanId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(harvestPlan);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HarvestPlanExists(harvestPlan.HarvestPlanId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TeacherId"] = new SelectList(_context.Teachers, "TeacherId", "FullName", harvestPlan.TeacherId);
            ViewData["GrupId"]    = new SelectList(_context.Grups, "GrupId", "Name", harvestPlan.GrupId);
            return(View(harvestPlan));
        }
Пример #2
0
 public async Task <IActionResult> Create([Bind("HarvestPlanId,Name,DepatmentId,TeacherId,GrupId")] HarvestPlan harvestPlan)
 {
     if (ModelState.IsValid)
     {
         Allubject();
         Current = harvestPlan;
         return(View("AddSubject"));
     }
     ViewData["TeacherId"] = new SelectList(_context.Teachers, "TeacherId", "FullName", harvestPlan.TeacherId);
     ViewData["GrupId"]    = new SelectList(_context.Grups.Where(x => x.isPranet == true), "GrupId", "Name", harvestPlan.GrupId);
     return(View(harvestPlan));
 }
Пример #3
0
        public async Task <IActionResult> CreateGrupChild(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var harvestPlan = await _context.HarvestPlans.Include(x => x.Subjects)
                              .FirstOrDefaultAsync(m => m.HarvestPlanId == id);

            if (harvestPlan == null)
            {
                return(NotFound());
            }

            Current = harvestPlan;
            Current.HarvestPlanId = 0;
            int GrupId = _context.Grups.FirstOrDefault(x => x.GrupId == Current.GrupId).DirectId;

            ViewData["GrupId"] = new SelectList(_context.Grups.Where(x => x.isPranet == false && x.DirectId == GrupId), "GrupId", "Name");

            return(View("CreateGrupChild", Current));
        }
Пример #4
0
        public async Task <IActionResult> Create()
        {
            var list = _context.HarvestPlans.Include(x => x.Grups).Where(x => x.Grups.isPranet == true).ToList();
            var grup = await _context.Grups.Include(c => c.DirectionList)
                       .Where(x => x.isPranet == true)
                       .ToListAsync();

            var grups = grup.Where(x => list.FirstOrDefault(y => y.Grups.DirectId == x.DirectId) == null).ToList();

            if (grups.Count > 0)
            {
                ViewData["grupItemNull"] = "Hamma gruplar uchun o'quv reja shakilantrilgan";
            }
            ViewData["TeacherId"]      = new SelectList(_context.Teachers, "TeacherId", "FullName");
            ViewData["GrupId"]         = new SelectList(grups, "GrupId", "Name");
            ViewData["DepartmentName"] = new SelectList(_context.Departments, "DepartmentId", "Name");
            var subject = _context.Subjects.Include(s => s.SubjectBlockType).ToList();

            ViewData["SujcetList"] = subject;
            Current          = new HarvestPlan();
            Current.Subjects = new List <SubjectTraingPlan>();
            return(View());
        }