Пример #1
0
        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));
        }
Пример #2
0
 public bool InsertProd(SolutionNew prod_new)
 {
     try
     {
         return(this.SolutionDAL.Insert(prod_new));
     }
     catch (Exception ex)
     {
         throw new Exception($"SolutionService:{ex.Message}");
     }
 }
Пример #3
0
 public bool UpdateProd(SolutionNew prod_new)
 {
     try
     {
         return(this.SolutionDAL.Update(prod_new));
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Пример #4
0
        public bool Insert(SolutionNew product)
        {
            Func <bool> func = new Func <bool>(() => {
                _entity.SolutionNew.Add(product);

                _entity.SaveChanges();

                return(true);
            });

            return(_adapter.Catch <bool>(func));
        }
Пример #5
0
        /// <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);
            }
        }
Пример #6
0
        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));
            }
        }