bool IEditable.Insert(AbstractModel item) { if (item.GetType() == typeof(Product)) { //_db.Product.Add((Product)item); //_db.SaveChanges(); return(true); } else { return(false); } }
private string GetModelErrors(AbstractModel model) { var res = string.Empty; foreach (var prop in model.GetType().GetProperties()) { if (model[prop.Name] != string.Empty) { res += model[prop.Name] + "\n"; } } return(res); }
bool IEditable.Update(int id, AbstractModel item) { if (item.GetType() == typeof(Product)) { var updateProduct = (Product)item; updateProduct.ProductID = Id; //_db.Product.Attach(updateProduct); //_db.SaveChanges(); return(true); } else { return(false); } }