public async Task <IActionResult> Edit(int id, [Bind("Id,Code,DescriptionRU,DescriptionKK,DescriptionEN")] PSubType pSubType)
        {
            if (id != pSubType.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pSubType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PSubTypeExists(pSubType.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pSubType));
        }
Esempio n. 2
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            PSubType pSubType = await db.PSubTypes.FindAsync(id);

            db.PSubTypes.Remove(pSubType);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Code,Description")] PSubType pSubType)
        {
            if (ModelState.IsValid)
            {
                db.Entry(pSubType).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(pSubType));
        }
        public async Task <IActionResult> Create([Bind("Id,Code,DescriptionRU,DescriptionKK,DescriptionEN")] PSubType pSubType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pSubType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(pSubType));
        }
Esempio n. 5
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Code,Description")] PSubType pSubType)
        {
            if (ModelState.IsValid)
            {
                db.PSubTypes.Add(pSubType);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(pSubType));
        }
Esempio n. 6
0
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PSubType pSubType = await db.PSubTypes.FindAsync(id);

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