public IActionResult SetDelivaryCostByArea(DelivaryCost newDelivaryCost) { if (ModelState.IsValid) { Context.DelivaryCost.Add(newDelivaryCost); Context.SaveChanges(); return(Content("Cost added successfully")); } return(View(newDelivaryCost)); }
// --------------------------------------------------------------------------- // Calculate Order TotalCost : public double DelivaryPlaceCost(int PlaceAreaID, int customerAreaID) { DelivaryCost cost = Context.DelivaryCost.FirstOrDefault(c => c.CustomerAreaID == customerAreaID && c.ShoppingPlaceAreaID == PlaceAreaID); if (cost != null) { return(cost.Cost); } else { return(5); } }