Beispiel #1
0
        public async Task <IActionResult> Create([Bind("ClientID,NHI,First,Last,Age,Location")] Client client)
        {
            if (ModelState.IsValid)
            {
                _context.Add(client);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(client));
        }
Beispiel #2
0
        public async Task <IActionResult> newReferral(int id)
        {
            // We need to (a) create a new episode, then atach to it a client and a referral entity and then send it to the view
            Referral referral = new Referral(); // no ID yet
            Client   client   = _context.Clients.Find(id);
            Episode  episode  = new Episode {
                Client = client, Referral = referral
            };

            episode.isOpen = true;

            string nameToPass = episode.Client.NHI + " " + episode.Client.First + " " + episode.Client.Last;

            ViewBag.Name = nameToPass;

            _context.Add(episode);
            await _context.SaveChangesAsync(); //will add all of the necessary id

            return(View(episode));
        }