public async Task <IActionResult> Edit(int id, [Bind("PkEnvFacilityKey,FkMillkey,NotAfpa,FkParentKey,Year,Company,HasCodischarge,CoBod,CoTss,CoFlow,CoSludge,CoAllSw,CoBoilers,CoTri,FkProdCatId,Eprodcat,MosOp,PrimaryProd,SecondaryProd,NumSpills,SpillComments,Penalty,PenaltyComments,GenComments,FossilFuelComments,BiomassComments,EnergyComments,NtProducts")] Env_Facility env_Facility)
        {
            if (id != env_Facility.PkEnvFacilityKey)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(env_Facility);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Env_FacilityExists(env_Facility.PkEnvFacilityKey))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["FkMillkey"]   = new SelectList(_context.MillInformation, "PkMillKey", "PkMillKey", env_Facility.FkMillKey);
            ViewData["FkProdCatId"] = new SelectList(_context.NcasiprodCat, "PkProdCatId", "PkProdCatId", env_Facility.FkProdCatId);
            return(View(env_Facility));
        }
        public async Task <IActionResult> Create([Bind("PkEnvFacilityKey,FkMillkey,NotAfpa,FkParentKey,Year,Company,HasCodischarge,CoBod,CoTss,CoFlow,CoSludge,CoAllSw,CoBoilers,CoTri,FkProdCatId,Eprodcat,MosOp,PrimaryProd,SecondaryProd,NumSpills,SpillComments,Penalty,PenaltyComments,GenComments,FossilFuelComments,BiomassComments,EnergyComments,NtProducts")] Env_Facility env_Facility)
        {
            if (ModelState.IsValid)
            {
                _context.Add(env_Facility);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["FkMillkey"]   = new SelectList(_context.MillInformation, "PkMillKey", "PkMillKey", env_Facility.FkMillKey);
            ViewData["FkProdCatId"] = new SelectList(_context.NcasiprodCat, "PkProdCatId", "PkProdCatId", env_Facility.FkProdCatId);
            return(View(env_Facility));
        }