Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Code,DescriptionRU,DescriptionKK,DescriptionEN")] ChemicalComp chemicalComp)
        {
            if (id != chemicalComp.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(chemicalComp);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ChemicalCompExists(chemicalComp.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(chemicalComp));
        }
Пример #2
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            ChemicalComp chemicalComp = await db.ChemicalComps.FindAsync(id);

            db.ChemicalComps.Remove(chemicalComp);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Пример #3
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Code,Description")] ChemicalComp chemicalComp)
        {
            if (ModelState.IsValid)
            {
                db.Entry(chemicalComp).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(chemicalComp));
        }
Пример #4
0
        public async Task <IActionResult> Create([Bind("Id,Code,DescriptionRU,DescriptionKK,DescriptionEN")] ChemicalComp chemicalComp)
        {
            if (ModelState.IsValid)
            {
                _context.Add(chemicalComp);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(chemicalComp));
        }
Пример #5
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Code,Description")] ChemicalComp chemicalComp)
        {
            if (ModelState.IsValid)
            {
                db.ChemicalComps.Add(chemicalComp);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(chemicalComp));
        }
Пример #6
0
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ChemicalComp chemicalComp = await db.ChemicalComps.FindAsync(id);

            if (chemicalComp == null)
            {
                return(HttpNotFound());
            }
            return(View(chemicalComp));
        }