Пример #1
0
        public void AddAliment(Aliment aliment)
        {
            if (aliment == null)
            {
                throw new ArgumentNullException(nameof(aliment));
            }

            _foodContext.Add(aliment);
        }
Пример #2
0
        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));
        }