public async Task <IActionResult> Create([Bind("State_ID,State_Name")] State state)
        {
            if (HttpContext.Session.GetString("SessionID") == null)
            {
                return(RedirectToAction("Create", "Login"));
            }
            if (ModelState.IsValid)
            {
                _context.Add(state);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(state));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("Order_ID,Order_Status,Patient_ID,Payment_Type_ID,Order_Amount,Order_Date,Deliver_Date,Is_Paid")] Order order)
        {
            if (HttpContext.Session.GetString("SessionID") == null)
            {
                return(RedirectToAction("Create", "Login"));
            }
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(order));
        }
        public async Task <IActionResult> Create([Bind("City_ID,State_ID,City_Name")] City city)
        {
            if (HttpContext.Session.GetString("SessionID") == null)
            {
                return(RedirectToAction("Create", "Login"));
            }
            if (ModelState.IsValid)
            {
                _context.Add(city);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StateId"] = new SelectList(_context.STATETB, "State_ID", "State_Name");
            return(View(city));
        }