示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("TipusID,TipusNev,Suly")] TermekTipus termekTipus)
        {
            if (id != termekTipus.TipusID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(termekTipus);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TermekTipusExists(termekTipus.TipusID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(termekTipus));
        }
示例#2
0
        public async Task <IActionResult> Edit(int id, [Bind("RaktarId,Nev,Cim,TelefonSZam")] Raktar raktar)
        {
            if (id != raktar.RaktarId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(raktar);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RaktarExists(raktar.RaktarId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(raktar));
        }
示例#3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Datum,Leiras")] Log log)
        {
            if (id != log.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(log);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LogExists(log.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(log));
        }
示例#4
0
        public async Task <IActionResult> Edit(int id, [Bind("LokacioId,LokacioNev,RaktarID,Foglalt")] Lokacio lokacio)
        {
            if (id != lokacio.LokacioId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(lokacio);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LokacioExists(lokacio.LokacioId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RaktarID"] = new SelectList(_context.Raktarak, "RaktarId", "RaktarId", lokacio.RaktarID);
            return(View(lokacio));
        }
示例#5
0
        public async Task <IActionResult> Edit(int id, [Bind("TermekID,LokacioId,TermekTipusId,Betarazva")] Termek termek)
        {
            Alkalmazott felh = _context.Alkalmazottak.FirstOrDefault(a => a.Id == userMgr.GetUserId(User).ToString());

            if (id != termek.TermekID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    var uj   = _context.Lokaciok.FirstOrDefault(l => l.LokacioId == termek.LokacioId);
                    var ter  = _context.Termekek.FirstOrDefault(t => t.TermekID == id);
                    var regi = _context.Lokaciok.FirstOrDefault(t => t.LokacioId == ter.LokacioId);

                    uj.Foglalt   = true;
                    regi.Foglalt = false;
                    Log bejegyzes = new Log {
                        Datum = DateTime.Now, Letrehozo = felh, Leiras = ter.TermekID.ToString() + " azonosítójú termék " + regi.LokacioNev + " lokációból " + uj.LokacioNev + " lokációra áthelyezve"
                    };

                    _context.Update(termek);
                    _context.Add(bejegyzes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TermekExists(termek.TermekID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LokacioId"]     = new SelectList(_context.Lokaciok, "LokacioId", "LokacioId", termek.LokacioId);
            ViewData["TermekTipusId"] = new SelectList(_context.TermekTipusok, "TipusID", "TipusID", termek.TermekTipusId);
            return(View(termek));
        }