示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("CholesterolRiskId,DateCholTaken,TotalCholesterol,LdlCholesterol,HdlCholesterol,Triglycerides,TakenAfterFasting,TotalCholGoal,LdlCholGoal,HdlCholGoal,TriglycerideGoal,Comments")] CholesterolRisk cholesterolRisk)
        {
            if (id != cholesterolRisk.CholesterolRiskId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cholesterolRisk);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CholesterolRiskExists(cholesterolRisk.CholesterolRiskId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cholesterolRisk));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("CholesterolRiskId,DateCholTaken,TotalCholesterol,LdlCholesterol,HdlCholesterol,Triglycerides,TakenAfterFasting,TotalCholGoal,LdlCholGoal,HdlCholGoal,TriglycerideGoal,Comments")] CholesterolRisk cholesterolRisk)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cholesterolRisk);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cholesterolRisk));
        }