Model Product
Chapeau
Probleem
Bij het toevoegen of wijzigen van een categorie zijn er enkele regels waarmee rekening moet gehouden worden. De validatie hiervan gebeurt in deze Bll klasse in de setters.
Alle velden van Category zijn verplicht en worden dus hierop gecontroleerd.
Design
Velden
Naam | Bereik | Type | Opmerking |
description | protected | string | |
name | protected | string | |
price | protected | float | |
image | protected | string | pad naar de afbeelding |
id | protected | int |
Methoden
Naam | Bereik | Type | Parameters | Retourneert | Opmerking |
Description | public | string | - | - | |
Name | public | string | - | - | |
Price | public | float | - | - | |
Image | public | string | - | - | |
Id | public | int | - | - |
Oplossing
/* Class: Product * modernways.be * created by an orm apart * Entreprise de modes et de manières modernes * Model for Webwinkel app * FileName: Models/ModernWays/Webwinkel/Product.cs * Created on Wednesday 14th of October 2015 12:24:02 PM */ // Code generated by An Orm Apart // do not modify the contents of this namespace namespace Webwinkel.Models { public class Product { // fields protected string description; protected string name; protected float price; protected string image; protected int id; // Getters and setters public string Description { get { return this.description; } set { this.description = value; } } public string Name { get { return this.name; } set { this.name = value; } } public float Price { get { return this.price; } set { this.price = value; } } public string Image { get { return this.image; } set { this.image = value; } } public int Id { get { return this.id; } set { this.id = value; } } public void set(string description, string name, float price, string image, int id) { this.Description = description; this.Name = name; this.Price = price; this.Image = image; this.Id = id; } } }
2016-11-28 13:10:37