private IReadOnlyList <ICustomerModel> ParseGetCustomersCustomers( JsonElement parent, string field) { if (!parent.TryGetProperty(field, out JsonElement obj)) { return(null); } if (obj.ValueKind == JsonValueKind.Null) { return(null); } int objLength = obj.GetArrayLength(); var list = new ICustomerModel[objLength]; for (int objIndex = 0; objIndex < objLength; objIndex++) { JsonElement element = obj[objIndex]; list[objIndex] = new CustomerModel ( DeserializeInt(element, "id"), DeserializeNullableString(element, "name"), DeserializeNullableString(element, "location") ); } return(list); }
public void ShipItem(ICustomerModel customer) { if (HasOrderBeenCompleted == false) { Console.WriteLine($"Simulating shipping { Title } to { customer.FirstName } in { customer.City }"); HasOrderBeenCompleted = true; } }
public void ShipItem(ICustomerModel customer) { if (HasOrderBeenCompleted == false) { Console.WriteLine($"Added the {Title} course to {customer.FirstName}'s account."); HasOrderBeenCompleted = true; } }
static Presenter() { UserModel = new UserModel(); ProductModel = new ProductModel(); SupplierModel = new SupplierModel(); OrderModel = new OrderModel(); DetailModel = new DetailModel(); CustomerModel = new CustomerModel(); }
public OrdersViewModel(ICustomerModel customer) : base(customer.CompanyName) { _customer = customer; if (IsInDesignMode) { // Code runs in Blend --> create design time data. } else { // Code runs "for real": Connect to service, etc... } }
public void ShipItem(ICustomerModel customer) { if (HasOrderBeenCompleted == false) { Console.WriteLine($"Simulating e-mailing { Title } to { customer.EmailAddress }"); TotalDownloadsLeft -= 1; if (TotalDownloadsLeft < 1) { HasOrderBeenCompleted = true; TotalDownloadsLeft = 0; } } }
public CustomerDetailsViewModel(string customerID) { _customer = ApplicationServices.Instance .NorthwindManager.GetCustomerByID(customerID); Name = Strings.CustomerDetailsDisplayName; ((INotifyPropertyChanged)_customer).PropertyChanged += CustomerDetailsViewModel_PropertyChanged; Orders = ApplicationServices.Instance .NorthwindManager.GetOrders( Customer.CustomerID); UpdateCommandViewModel = new CommandViewModel( Strings.UpdateCommandName, new RelayCommand(UpdateCommand_Execute, UpdateCommand_CanExecute)); }
static void Main(string[] args) { List <IProductModel> cart = AddSampleData(); ICustomerModel customer = GetCustomer(); foreach (IProductModel prod in cart) { prod.ShipItem(customer); if (prod is IDigitalProductModel digital) { Console.WriteLine($"For the {digital.Title} you have {digital.TotalDownloadsLeft} downloads left"); } } Console.ReadLine(); }
public void Put([FromBody] ICustomerModel value) { _customerService.Update(value); }
public void Post([FromBody] ICustomerModel value) { _customerService.Add(value); }
public bool Update(ICustomerModel model) { var customer = _mapper.Map <Customer>(model); return(_repo.Update(customer)); }
public ICustomerModel Add(ICustomerModel model) { var customer = _mapper.Map <Customer>(model); return(_mapper.Map <CustomerModel>(_repo.Add(customer))); }
public CustomerViewModel(ICustomerModel model) { _model = model; ((INotifyPropertyChanged)_model).PropertyChanged += CustomerViewModelPropertyChanged; }