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

            this.FixNullFields(val);

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(val);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Exists(val.EnumCritterLifeEventCategoryId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            return(View(val));
        }
 private void FixNullFields(EnumCritterLifeEventCategory val)
 {
     if (String.IsNullOrWhiteSpace(val.Comment))
     {
         val.Comment = "N/A";
     }
     if (String.IsNullOrWhiteSpace(val.Description))
     {
         val.Description = "N/A";
     }
 }
        public async Task <IActionResult> Create([Bind("EnumCritterLifeEventCategoryId,Comment,Description,Timestamp,VersionNumber")] EnumCritterLifeEventCategory val)
        {
            this.FixNullFields(val);
            if (ModelState.IsValid)
            {
                _context.Add(val);
                await _context.SaveChangesAsync();

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

            return(View(val));
        }