Exemple #1
0
        public async Task <IActionResult> Edit(string id, [Bind("Session,studentname,email,problemDetails,DrugList")] DailyStudentServiceList dailyStudentServiceList)
        {
            if (id != dailyStudentServiceList.Session)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(dailyStudentServiceList);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DailyStudentServiceListExists(dailyStudentServiceList.Session))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(dailyStudentServiceList));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("Session,studentname,email,problemDetails,DrugList")] DailyStudentServiceList dailyStudentServiceList)
        {
            if (ModelState.IsValid)
            {
                _context.Add(dailyStudentServiceList);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(dailyStudentServiceList));
        }
Exemple #3
0
        public async Task <IActionResult> Show(string id)
        {
            DailyStudentServiceList dailyStudentServiceList = await _context.dailyStudentServiceLists
                                                              .FirstOrDefaultAsync(m => m.Session == id);

            var druglist = _context.drugInfoPerStudents;

            foreach (var session in druglist)
            {
                if (dailyStudentServiceList.Session == session.Session)
                {
                    dailyStudentServiceList.DrugInfoPerStudents.Add(session);
                }
            }
            List <DrugInfoPerStudent> drugInfoPerStudent = dailyStudentServiceList.DrugInfoPerStudents;

            return(View(drugInfoPerStudent));
        }