Exemple #1
0
        public async Task <IActionResult> Create([Bind("CatId,CatDescription")] Category category)
        {
            if (ModelState.IsValid)
            {
                _context.Add(category);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("ConditionId,Cond")] Condition condition)
        {
            if (ModelState.IsValid)
            {
                _context.Add(condition);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(condition));
        }
Exemple #3
0
        public async Task <IActionResult> Create([Bind("UserId,Username,UserPassword,FirstName,LastName")] LoginInfo loginInfo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(loginInfo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(loginInfo));
        }
Exemple #4
0
        public async Task <IActionResult> Create([Bind("RatingId,Rating1")] Rating rating)
        {
            if (ModelState.IsValid)
            {
                _context.Add(rating);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(rating));
        }
Exemple #5
0
        public async Task <IActionResult> Create([Bind("UserId,City,UsaState,Zip,PhoneNumber,Email,Age,DateJoin,RatingId,LoginId")] UserInfo userInfo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(userInfo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LoginId"]  = new SelectList(_context.LoginInfo, "UserId", "Username", userInfo.LoginId);
            ViewData["RatingId"] = new SelectList(_context.Rating, "RatingId", "RatingId", userInfo.RatingId);
            return(View(userInfo));
        }
        public async Task <IActionResult> Create([Bind("Id,UserId,ConditionId,CatId")] Post post)
        {
            if (ModelState.IsValid)
            {
                _context.Add(post);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CatId"]       = new SelectList(_context.Category, "CatId", "CatId", post.CatId);
            ViewData["ConditionId"] = new SelectList(_context.Condition, "ConditionId", "ConditionId", post.ConditionId);
            ViewData["UserId"]      = new SelectList(_context.LoginInfo, "UserId", "Username", post.UserId);
            return(View(post));
        }