コード例 #1
0
ファイル: ListsController.cs プロジェクト: dlagg/ClaveSol
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Deleted,UserId,ListId")] List list)
        {
            if (id != list.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(list);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ListExists(list.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.User, "Id", "Mail", list.UserId);
            return(View(list));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Quantity,UnitaryPrice,TotalPrice,OrderId,InstrumentId")] LineOrder lineOrder)
        {
            if (id != lineOrder.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(lineOrder);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LineOrderExists(lineOrder.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["InstrumentId"] = new SelectList(_context.Instrument, "Id", "Brand", lineOrder.InstrumentId);
            ViewData["OrderId"]      = new SelectList(_context.Order, "Id", "State", lineOrder.OrderId);
            return(View(lineOrder));
        }
コード例 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Date,Category,Title,Body,OperatorId,OrderId")] Tiket tiket)
        {
            if (id != tiket.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tiket);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TiketExists(tiket.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OperatorId"] = new SelectList(_context.Operator, "Id", "Id", tiket.OperatorId);
            ViewData["OrderId"]    = new SelectList(_context.Order, "Id", "State", tiket.OrderId);
            return(View(tiket));
        }
コード例 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Date,Title,Body,Stars,Deleted,UserId,InstrumentId")] Comment comment)
        {
            if (id != comment.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(comment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CommentExists(comment.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["InstrumentId"] = new SelectList(_context.Instrument, "Id", "Brand", comment.InstrumentId);
            ViewData["UserId"]       = new SelectList(_context.User, "Id", "Mail", comment.UserId);
            return(View(comment));
        }
コード例 #5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Brand,Price,State,Description,MediaDir,SubCategoryId,InstrumentId,shInsId,attrInsId")] Instrument instrument)
        {
            if (id != instrument.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(instrument);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InstrumentExists(instrument.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SubCategoryId"] = new SelectList(_context.SubCategory, "Id", "Name", instrument.SubCategoryId);
            return(View(instrument));
        }
コード例 #6
0
ファイル: AttributsController.cs プロジェクト: dlagg/ClaveSol
        public async Task <IActionResult> Edit(int id, [Bind("Id,Type,Value,AttributId")] Attribut attribut)
        {
            if (id != attribut.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(attribut);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AttributExists(attribut.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(attribut));
        }
コード例 #7
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,CategoryId")] SubCategory subCategory)
        {
            if (id != subCategory.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(subCategory);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SubCategoryExists(subCategory.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.Category, "Id", "Name", subCategory.CategoryId);
            return(View(subCategory));
        }
コード例 #8
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Surname,Mail,Premium,OwnerID,Status")] User user, string pass, string role)
        {
            user.Status = 0;
            if (id != user.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await IdentityLink(null, role, user, 'e');

                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
コード例 #9
0
        public async Task <IActionResult> Edit(int id, [Bind("Id")] Operator @operator)
        {
            if (id != @operator.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(@operator);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OperatorExists(@operator.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(@operator));
        }
コード例 #10
0
ファイル: ShopsController.cs プロジェクト: dlagg/ClaveSol
        public async Task <IActionResult> Edit(int id, [Bind("Id,City,ShopId")] Shop shop)
        {
            if (id != shop.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(shop);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ShopExists(shop.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(shop));
        }
コード例 #11
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Category category)
        {
            if (id != category.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(category);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CategoryExists(category.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }
コード例 #12
0
ファイル: OrdersController.cs プロジェクト: dlagg/ClaveSol
        public async Task <IActionResult> Edit(int id, [Bind("Id,Date,nLines,Price,State,UserId")] Order order)
        {
            if (id != order.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(order);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderExists(order.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.User, "Id", "Mail", order.UserId);
            return(View(order));
        }
コード例 #13
0
ファイル: ChatsController.cs プロジェクト: dlagg/ClaveSol
        public async Task <IActionResult> Edit(int id, [Bind("Id,StartDate,EndDate,FileName,Resolved,UserId,OperatorId")] Chat chat)
        {
            if (id != chat.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(chat);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ChatExists(chat.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OperatorId"] = new SelectList(_context.Set <Operator>(), "Id", "Id", chat.OperatorId);
            ViewData["UserId"]     = new SelectList(_context.User, "Id", "Mail", chat.UserId);
            return(View(chat));
        }