public async Task <ActionResult> Create([Bind(Include = "Id,code,simpleName,commonName,scientificName,shapeCoefficient,limitYear,dryMaterial")] Species species)
        {
            if (ModelState.IsValid)
            {
                context.Species.Add(species);
                await context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(species));
        }
예제 #2
0
        public async Task <ActionResult> Create([Bind(Include = "Id,SpeciesId,Name,Expression")] MathExpression mathExpression)
        {
            if (ModelState.IsValid)
            {
                db.MathExpressions.Add(mathExpression);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.SpeciesId = new SelectList(db.Species, "Id", "code", mathExpression.SpeciesId);
            return(View(mathExpression));
        }
        public async Task <ActionResult> Create([Bind(Include = "id,specieId,groundIndexId,value")] SpeciesGroundIndex speciesGroundIndex)
        {
            if (ModelState.IsValid)
            {
                context.SpeciesGroundIndexes.Add(speciesGroundIndex);
                await context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.groundIndexId = new SelectList(context.GroundIndexes, "Id", "name", speciesGroundIndex.groundIndexId);
            ViewBag.specieId      = new SelectList(context.Species, "Id", "code", speciesGroundIndex.specieId);
            return(View(speciesGroundIndex));
        }