public async Task <IActionResult> Edit(int id, [Bind("PoultryClassificationId,Comment,CritterTypeId,Timestamp,VersionNumber")] PoultryClassification val)
        {
            if (val.PoultryClassificationId != id)
            {
                return(NotFound());
            }

            this.FixNullFields(val);

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(val);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Exists(val.PoultryClassificationId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CritterTypeId"] = new SelectList(_context.CritterType, "CritterTypeId", "Name", val.CritterTypeId);
            return(View(val));
        }
 private void FixNullFields(PoultryClassification val)
 {
     if (String.IsNullOrWhiteSpace(val.Comment))
     {
         val.Comment = "N/A";
     }
 }
        public async Task <IActionResult> Create([Bind("PoultryClassificationId,Comment,CritterTypeId,Timestamp,VersionNumber")] PoultryClassification val)
        {
            this.FixNullFields(val);
            if (ModelState.IsValid)
            {
                _context.Add(val);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CritterTypeId"] = new SelectList(_context.CritterType, "CritterTypeId", "Name", val.CritterTypeId);
            return(View(val));
        }