Exemplo n.º 1
0
        public async Task <IActionResult> Edit(string id, [Bind("Id,ClientId,BilirubunAtBirth,Dob,BirthWeight,GestationalAge,MothersFirstName,MothersMiddleName,MothersLastName,MothersNrc")] Neonate neonate)
        {
            if (id != neonate.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(neonate);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NeonateExists(neonate.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClientId"] = new SelectList(_context.Client, "Id", "Id", neonate.ClientId);
            return(View(neonate));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,ClientId,BilirubunAtBirth,Dob,BirthWeight,GestationalAge,MothersFirstName,MothersMiddleName,MothersLastName,MothersNrc")] Neonate neonate)
        {
            if (ModelState.IsValid)
            {
                _context.Add(neonate);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClientId"] = new SelectList(_context.Client, "Id", "Id", neonate.ClientId);
            return(View(neonate));
        }