コード例 #1
0
        public void AddAliment(Aliment aliment)
        {
            if (aliment == null)
            {
                throw new ArgumentNullException(nameof(aliment));
            }

            _foodContext.Add(aliment);
        }
コード例 #2
0
ファイル: EmployeeController.cs プロジェクト: Mar70/Fast-Food
        public async Task <IActionResult> Create([Bind("ID,FirstName,LastName,Role,PhoneNumber,Salary")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("ID,OrderType,DriveOut,DriveIn")] Order order)
        {
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(order));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("foodId,brand,flavour,type")] Food food)
        {
            if (ModelState.IsValid)
            {
                _context.Add(food);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(food));
        }
コード例 #5
0
        public async Task <IActionResult> Create([Bind("ID,Type")] OrderItemDetail orderItemDetail)
        {
            if (ModelState.IsValid)
            {
                _context.Add(orderItemDetail);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(orderItemDetail));
        }
コード例 #6
0
        public async Task <IActionResult> Create([Bind("ID,FoodName,FoodType,FoodDescription,ExpiryDate")] Food food)
        {
            if (ModelState.IsValid)
            {
                _context.Add(food);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(food));
        }
コード例 #7
0
        public async Task <IActionResult> Create([Bind("ID,FirstName,LastName,StreetAddress,City,State,Zip")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
コード例 #8
0
        public async Task <IActionResult> Create([Bind("ID,ImageFile,FoodName,FoodType,Price")] Food food)
        {
            if (ModelState.IsValid)
            {
                CloudBlobContainer container = getBlobStorageInformation();
                CloudBlockBlob     blob      = container.GetBlockBlobReference(food.ImageFile.FileName);
                using (var fileStream = food.ImageFile.OpenReadStream())
                {
                    blob.UploadFromStreamAsync(fileStream).Wait();
                }

                food.FoodImage = blob.Uri.ToString();

                _context.Add(food);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(food));
        }