Esempio n. 1
0
 private void CheckSupplyHeader(SupplyHeader h)
 {
     if (h.SupplyDetail == null)
     {
         _context.Remove(h);
         _context.SaveChanges();
     }
 }
Esempio n. 2
0
        public async Task <IActionResult> CreateSupply([Bind("Provider, RecipientId")] SupplyHeader header)
        {
            if (ModelState.IsValid)
            {
                RemoveEmptySupplyHeaders();
                header.CreationDate = DateTime.Now;
                _context.SupplyHeaders.Add(header);
                await _context.SaveChangesAsync();

                return(RedirectToAction("SupplyBikes", "Admin", new { headerid = header.Id }));
            }
            ViewData["Staff"] = _context.Users.FirstOrDefault(u => u.Email == User.Identity.Name);
            return(View("CreateSupply", header));
        }