public bool Update(GoldWorldPriceVM entity)
        {
            GoldWorldPrice ig = new GoldWorldPrice
            {
                ID        = entity.ID,
                ARName    = entity.ARName,
                Code      = entity.Code,
                LatName   = entity.LatName,
                PriceDate = entity.PriceDate,
                GoldPrice = entity.GoldPrice,

                Notes      = entity.Notes,
                KiloPrice  = entity.KiloPrice,
                OuncePrice = entity.OuncePrice
            };

            try
            {
                goldWorldPriceRepo.Update(ig, ig.ID);
            }
            catch (Exception ex)
            {
            }
            return(true);
        }
        public Task <int> InsertAsync(GoldWorldPriceVM entity)
        {
            return(Task.Run <int>(async() =>
            {
                GoldWorldPrice ig = new GoldWorldPrice
                {
                    ID = entity.ID,
                    ARName = entity.ARName,
                    Code = entity.Code,
                    LatName = entity.LatName,
                    PriceDate = entity.PriceDate,
                    GoldPrice = entity.GoldPrice,

                    Notes = entity.Notes,
                    KiloPrice = entity.KiloPrice,
                    OuncePrice = entity.OuncePrice
                };
                try
                {
                    goldWorldPriceRepo.Add(ig);
                    await UpdateItemPrices(ig);
                }
                catch (Exception ex)
                {
                }
                return ig.ID;
            }
                                  ));
        }
        public Task <bool> UpdateItemPrices(GoldWorldPrice entity)
        {
            return(Task.Run <bool>(() =>
            {
                SqlParameter GlobalGoldPriceParam = new SqlParameter("@GlobalGoldPrice", (object)entity.GoldPrice);
                SqlParameter KiloPriceParam = new SqlParameter("@KiloPrice", (object)entity.KiloPrice);
                SqlParameter OuncePriceParam = new SqlParameter("@OuncePrice", (object)entity.OuncePrice);

                try
                {
                    var count = itemsRepo.ExecuteSqlCommand("exec UPDATE_ITEMS_PRICES  @GlobalGoldPrice,@KiloPrice,@OuncePrice", GlobalGoldPriceParam, KiloPriceParam, OuncePriceParam);
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }));
        }
        public bool Insert(GoldWorldPriceVM entity)
        {
            GoldWorldPrice ig = new GoldWorldPrice
            {
                ID        = entity.ID,
                ARName    = entity.ARName,
                Code      = entity.Code,
                LatName   = entity.LatName,
                PriceDate = entity.PriceDate,
                GoldPrice = entity.GoldPrice,

                Notes      = entity.Notes,
                KiloPrice  = entity.KiloPrice,
                OuncePrice = entity.OuncePrice
            };

            goldWorldPriceRepo.Add(ig);
            return(true);
        }
        public Task <bool> DeleteAsync(GoldWorldPriceVM entity)
        {
            return(Task.Run <bool>(() =>
            {
                GoldWorldPrice ig = new GoldWorldPrice
                {
                    ID = entity.ID,
                    ARName = entity.ARName,
                    Code = entity.Code,
                    LatName = entity.LatName,
                    PriceDate = entity.PriceDate,
                    GoldPrice = entity.GoldPrice,

                    Notes = entity.Notes,
                    KiloPrice = entity.KiloPrice,
                    OuncePrice = entity.OuncePrice
                };
                goldWorldPriceRepo.Delete(ig, entity.ID);
                return true;
            }));
        }