Denmark Puso

Denmark Puso

  • NA
  • 232
  • 47.6k

2 condition inside foreach?

Oct 21 2019 9:18 AM
is it possible that i have 2 condition inside of foreach ? see my code below.
 
 
  1. public ActionResult Add(OrderFormModel model, int[] DynamicTextBox, string[] DynamicTextBox2)
    {

  2. foreach (int textBoxValue in DynamicTextBox && string textBoxValue2 in DynamicTextBox2)  
  3.                         {  
  4.                             var getMaxId = _orderService.GetAll().OrderByDescending(x => x.Id).FirstOrDefault();  
  5.   
  6.                             var order = new Order  
  7.                             {  
  8.                                 ClientId = model.ClientId,  
  9.                                 StateId = model.StateId,  
  10.                                 CityId = model.CityId,  
  11.                                 TownId = model.TownId,  
  12.                                 Postcode = model.Postcode,  
  13.                                 Deposit = textBoxValue,  
  14.                                 TrackingNumber = textBoxValue2,  
  15.                                 Address = model.Address,  
  16.                                 DatePosted = Convert.ToDateTime(model.DatePosted),  
  17.                                 DeliveryDate = Convert.ToDateTime(model.DeliveryDate),  
  18.                                 Quantity = 1,  
  19.                                 Status = "Lined-up",  
  20.                                 DateDelivered = null,  
  21.                                 Notes = model.Notes ?? "",  
  22.                             }; 
  23. }

Answers (3)