예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Advertiser,LastDate,Price,StatuId,EngineerId,Sadad,Note,PdfFile")] Monafsa monafsa)
        {
            if (id != monafsa.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    context.Update(monafsa);
                    await context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MonafsaExists(monafsa.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Details), new { id = monafsa.Id }));
            }
            ViewData["EngineerId"] = new SelectList(context.Engineers, "Id", "Name", monafsa.EngineerId);
            ViewData["StatuId"]    = new SelectList(context.Status, "Id", "Name", monafsa.StatuId);
            return(View(monafsa));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Statu statu)
        {
            if (id != statu.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(statu);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StatuExists(statu.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(statu));
        }
예제 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,ItemCode,Name,Count,Price,BuyPrice,MonafsaId,UnitsId")] Item item)
        {
            if (id != item.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(item);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ItemExists(item.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Monafsa), new { id = item.MonafsaId }));
            }
            ViewData["MonafsaId"] = new SelectList(_context.Monafsas, "Id", "Name", item.MonafsaId);
            ViewData["UnitsId"]   = new SelectList(_context.Units, "Id", "Name", item.UnitsId);
            return(View(item));
        }