示例#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));
            }
        }