コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,Seq")] MenuCategory menuCategory)
        {
            if (ModelState.IsValid)
            {
                _context.Add(menuCategory);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(menuCategory));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Phone,Url,ImageUrl")] Restaurant restaurant)
        {
            if (ModelState.IsValid)
            {
                _context.Add(restaurant);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(restaurant));
        }
コード例 #3
0
        public async Task <IActionResult> Create(Pickup newpickup)
        {
            if (ModelState.IsValid)
            {
                _context.Add(newpickup);
                await _context.SaveChangesAsync();

                if (Request.Form["sendSlack"] == "on")
                {
                    var pickup = _repo.pickups.Get(newpickup.Id);
                    var msg    = string.Concat(pickup.PickupUser.NicknameOrUser, " is heading to ",
                                               pickup.Restaurant.Name, " at ", pickup.PickupTime.ToString("HH:mm tt"), ". Get your orders in!");
                    var success = await PostToSlack(newpickup.Id, "New Pickup", msg);
                }
                return(RedirectToAction(nameof(Details), new { id = newpickup.Id }));
            }
            LoadPickUpUserList(newpickup.PickupUserId);
            return(View(newpickup));
        }