public void AddAliment(Aliment aliment) { if (aliment == null) { throw new ArgumentNullException(nameof(aliment)); } _foodContext.Add(aliment); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }