Example #1
0
        public async Task <IActionResult> Create([Bind("Id")] Operator @operator)
        {
            if (ModelState.IsValid)
            {
                _context.Add(@operator);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(@operator));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("Id,Type,Value,AttributId")] Attribut attribut)
        {
            if (ModelState.IsValid)
            {
                _context.Add(attribut);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(attribut));
        }
Example #3
0
        public async Task <IActionResult> Create([Bind("Id,City,ShopId")] Shop shop)
        {
            if (ModelState.IsValid)
            {
                _context.Add(shop);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(shop));
        }
Example #4
0
        public async Task <IActionResult> Create([Bind("Id,Name")] Category category)
        {
            if (ModelState.IsValid)
            {
                _context.Add(category);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }
Example #5
0
        public async Task <IActionResult> Create([Bind("Id,Name,Deleted,UserId,ListId")] List list)
        {
            if (ModelState.IsValid)
            {
                _context.Add(list);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.User, "Id", "Mail", list.UserId);
            return(View(list));
        }
Example #6
0
        public async Task <IActionResult> Create([Bind("Id,Name,Brand,Price,State,Description,MediaDir,SubCategoryId,InstrumentId,shInsId,attrInsId")] Instrument instrument)
        {
            if (ModelState.IsValid)
            {
                _context.Add(instrument);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SubCategoryId"] = new SelectList(_context.SubCategory, "Id", "Name", instrument.SubCategoryId);
            return(View(instrument));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,CategoryId")] SubCategory subCategory)
        {
            if (ModelState.IsValid)
            {
                _context.Add(subCategory);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.Category, "Id", "Name", subCategory.CategoryId);
            return(View(subCategory));
        }
Example #8
0
        public async Task <IActionResult> Create([Bind("Id,Date,nLines,Price,State,UserId")] Order order)
        {
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.User, "Id", "Mail", order.UserId);
            return(View(order));
        }
Example #9
0
        public async Task <IActionResult> Create([Bind("Id,Name,Quantity,UnitaryPrice,TotalPrice,OrderId,InstrumentId")] LineOrder lineOrder)
        {
            if (ModelState.IsValid)
            {
                _context.Add(lineOrder);
                await _context.SaveChangesAsync();

                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));
        }
Example #10
0
        public async Task <IActionResult> Create([Bind("Id,Date,Title,Body,Stars,Deleted,UserId,InstrumentId")] Comment comment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(comment);
                await _context.SaveChangesAsync();

                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));
        }
Example #11
0
        public async Task <IActionResult> Create([Bind("Id,Date,Category,Title,Body,OperatorId,OrderId")] Tiket tiket)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tiket);
                await _context.SaveChangesAsync();

                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));
        }
Example #12
0
        public async Task <IActionResult> Create([Bind("Id,StartDate,EndDate,FileName,Resolved,UserId,OperatorId")] Chat chat)
        {
            if (ModelState.IsValid)
            {
                _context.Add(chat);
                await _context.SaveChangesAsync();

                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));
        }
Example #13
0
        public async Task <IActionResult> Create([Bind("Id,Name,Surname,Mail,Premium,OwnerID,Status")] User user, string pass, string role)
        {
            user.Status = 0;
            if (ModelState.IsValid)
            {
                _context.Add(user);

                await IdentityLink(pass, role, user, 'c');

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }