public bool Update(SolutionNew product) { Func <bool> func = new Func <bool>(() => { _entity.Entry(product).State = EntityState.Modified; _entity.SaveChanges(); return(true); }); return(_adapter.Catch <bool>(func)); }
public bool InsertProd(SolutionNew prod_new) { try { return(this.SolutionDAL.Insert(prod_new)); } catch (Exception ex) { throw new Exception($"SolutionService:{ex.Message}"); } }
public bool UpdateProd(SolutionNew prod_new) { try { return(this.SolutionDAL.Update(prod_new)); } catch (Exception ex) { return(false); } }
public bool Insert(SolutionNew product) { Func <bool> func = new Func <bool>(() => { _entity.SolutionNew.Add(product); _entity.SaveChanges(); return(true); }); return(_adapter.Catch <bool>(func)); }
/// <summary> /// 取得產品細節 /// </summary> /// <param name="num"></param> /// <returns></returns> public SolutionNew GetProductDetail(int num) { SolutionNew result = null; try { return(this.SolutionDAL.Get(num)); } catch (Exception ex) { return(result); } }
public bool Delete(SolutionNew product) { // { Func <bool> func = new Func <bool>(() => { var product_new = _entity.SolutionNew .Where(e => e.Num == product.Num).FirstOrDefault(); _entity.SolutionNew.Remove(product_new); _entity.SaveChanges(); return(true); }); return(_adapter.Catch <bool>(func)); } }