protected override void Init() { Products = new List <TrainingProduct>(); SearchEntity = new TrainingProduct(); Entity = new TrainingProduct(); base.Init(); }
private void Add() { IsValid = true; Entity = new TrainingProduct(); Entity.IntroductionDate = DateTime.Now; Entity.Url = "http://"; Entity.Price = 0; AddMode(); }
public List <TrainingProduct> Get(TrainingProduct entity) { var ret = CreateMockData(); if (!string.IsNullOrEmpty(entity.ProductName)) { ret = ret.Where(_ => _.ProductName.ToLower().StartsWith(entity.ProductName, StringComparison.CurrentCultureIgnoreCase)); } return(ret.ToList()); }
public bool Update(TrainingProduct entity) { var ret = false; ret = Validate(entity); if (ret) { // TODO: Create UPDATE code here } return(ret); }
public bool Insert(TrainingProduct entity) { var ret = false; ret = Validate(entity); if (ret) { // TODO: Create INSERT code here } return(ret); }
public bool Validate(TrainingProduct entity) { ValidationErrors.Clear(); if (!string.IsNullOrEmpty(entity.ProductName)) { if (entity.ProductName.ToLower() == entity.ProductName) { ValidationErrors.Add(new KeyValuePair <string, string>("ProductName", "Product Name must not be all lower case.")); } } return(ValidationErrors.Count == 0); }
private void ResetSearch() { SearchEntity = new TrainingProduct(); }
public bool Delete(TrainingProduct entity) { //TODO: delete code here return(true); }