public async Task <IActionResult> Create([Bind("Id,Name,Color,Size,TotalQuantityInInventory,IsActive")] SwagItem swagItem) { var TerritorySwagItems = new List <TerritorySwagItem>(); var territories = _context.Territory.ToList(); if (ModelState.IsValid) { _context.Add(swagItem); await _context.SaveChangesAsync(); foreach (var territory in territories) { TerritorySwagItems.Add(new TerritorySwagItem { SwagItemId = swagItem.Id, TerritoryId = territory.Id, QuantityInTerritoryInventory = 0 }); } _context.AddRange(TerritorySwagItems); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(swagItem)); }
public void MarkAsSwagged(SwagItem swag) { _swagRepository.MarkAsSwagged(swag); }
public void AddSwag(SwagItem swag) { _swagRepository.AddSwag(swag); }
public void AttendeeReceivedSwag(Attendee attendee, SwagItem swagItem) { attendee.ReceivedSwag.Add(swagItem.Name); }
public void MarkAsSwagged(SwagItem swagItem) { swagItem.HasBeenSwagged = true; }
public void RemoveSwag(SwagItem swag) { _swag.Remove(swag); }
public void AddSwag(SwagItem swag) { _swag.Add(swag); }
public void AttendeeReceivedSwag(Attendee attendee, SwagItem swag) { _attendeeRepository.AttendeeReceivedSwag(attendee, swag); }