Пример #1
0
        public async Task <IHttpActionResult> Update(int id, CoinRate coinRate)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != coinRate.Id)
            {
                return(BadRequest());
            }

            db.Entry(coinRate).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();

                FCMPushNotification fcm = new FCMPushNotification();
                fcm.SendNotification(coinRate.Link.Name, coinRate.Rate, coinRate.LinkId, "LatestRate");
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CoinRateExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
    public override int GetHashCode()
    {
        int hashcode = 157;

        unchecked {
            if (__isset.currencyCode)
            {
                hashcode = (hashcode * 397) + CurrencyCode.GetHashCode();
            }
            if (__isset.currencyName)
            {
                hashcode = (hashcode * 397) + CurrencyName.GetHashCode();
            }
            if (__isset.currencySign)
            {
                hashcode = (hashcode * 397) + CurrencySign.GetHashCode();
            }
            if (__isset.preferred)
            {
                hashcode = (hashcode * 397) + Preferred.GetHashCode();
            }
            if (__isset.coinRate)
            {
                hashcode = (hashcode * 397) + CoinRate.GetHashCode();
            }
            if (__isset.creditRate)
            {
                hashcode = (hashcode * 397) + CreditRate.GetHashCode();
            }
        }
        return(hashcode);
    }
Пример #3
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            CoinRate coinRate = await db.CoinRates.FindAsync(id);

            db.CoinRates.Remove(coinRate);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Пример #4
0
        public async Task <IHttpActionResult> Get(int id)
        {
            CoinRate coinRate = await db.CoinRates.FindAsync(id);

            if (coinRate == null)
            {
                return(NotFound());
            }

            return(Ok(coinRate));
        }
Пример #5
0
        public async Task <IHttpActionResult> Delete(int id)
        {
            CoinRate coinRate = await db.CoinRates.FindAsync(id);

            if (coinRate == null)
            {
                return(NotFound());
            }

            db.CoinRates.Remove(coinRate);
            await db.SaveChangesAsync();

            return(Ok(coinRate));
        }
Пример #6
0
        // GET: CoinRates/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CoinRate coinRate = await db.CoinRates.FindAsync(id);

            if (coinRate == null)
            {
                return(HttpNotFound());
            }
            return(View(coinRate));
        }
Пример #7
0
        // GET: CoinRates/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CoinRate coinRate = await db.CoinRates.FindAsync(id);

            if (coinRate == null)
            {
                return(HttpNotFound());
            }
            ViewBag.LinkId = new SelectList(db.Links, "Id", "Name", coinRate.LinkId);
            return(View(coinRate));
        }
Пример #8
0
        public async Task <IHttpActionResult> Add(CoinRate coinRate)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.CoinRates.Add(coinRate);
            await db.SaveChangesAsync();


            FCMPushNotification fcm = new FCMPushNotification();

            fcm.SendNotification(coinRate.Link.Name, coinRate.Rate, coinRate.LinkId, "LatestRate");

            return(CreatedAtRoute("DefaultApi", new { id = coinRate.Id }, coinRate));
        }
Пример #9
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Rate,LinkId,CreatedDate,CreatedBy,UpdatedDate,UpdatedBy,IsActived,IsDeleted")] CoinRate coinRate)
        {
            if (ModelState.IsValid)
            {
                coinRate.CreatedBy       = "Auto";
                coinRate.CreatedDate     = DateTime.Now;
                coinRate.UpdatedBy       = "Auto";
                coinRate.UpdatedDate     = DateTime.Now;
                coinRate.IsActived       = true;
                coinRate.IsDeleted       = false;
                db.Entry(coinRate).State = EntityState.Modified;
                await db.SaveChangesAsync();

                var link = db.Links.Single(a => a.Id == coinRate.LinkId);
                FCMPushNotification fcm = new FCMPushNotification();
                fcm.SendNotification(link.Name, coinRate.Rate, coinRate.LinkId, "LatestRate");

                return(RedirectToAction("Index"));
            }
            ViewBag.LinkId = new SelectList(db.Links, "Id", "Name", coinRate.LinkId);
            return(View(coinRate));
        }
Пример #10
0
 protected bool Equals(DropItemValues other)
 {
     return(Id == other.Id &&
            ShardId == other.ShardId &&
            ShardRate.Equals(other.ShardRate) &&
            RareItemId == other.RareItemId &&
            RareItemQuantity == other.RareItemQuantity &&
            RareItemRate.Equals(other.RareItemRate) &&
            CommonItemId == other.CommonItemId &&
            CommonItemQuantity == other.CommonItemQuantity &&
            CommonRate.Equals(other.CommonRate) &&
            RareIngredientId == other.RareIngredientId &&
            RareIngredientQuantity == other.RareIngredientQuantity &&
            RareIngredientRate.Equals(other.RareIngredientRate) &&
            CommonIngredientId == other.CommonIngredientId &&
            CommonIngredientQuantity == other.CommonIngredientQuantity &&
            CommonIngredientRate.Equals(other.CommonIngredientRate) &&
            CoinType == other.CoinType &&
            CoinOverride == other.CoinOverride &&
            CoinRate.Equals(other.CoinRate) &&
            AreaChangeTreasureFlag == other.AreaChangeTreasureFlag &&
            ItemType == other.ItemType);
 }
Пример #11
0
    public override string ToString()
    {
        var  sb      = new StringBuilder("PaidCallCurrencyExchangeRate(");
        bool __first = true;

        if (CurrencyCode != null && __isset.currencyCode)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("CurrencyCode: ");
            CurrencyCode.ToString(sb);
        }
        if (CurrencyName != null && __isset.currencyName)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("CurrencyName: ");
            CurrencyName.ToString(sb);
        }
        if (CurrencySign != null && __isset.currencySign)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("CurrencySign: ");
            CurrencySign.ToString(sb);
        }
        if (__isset.preferred)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Preferred: ");
            Preferred.ToString(sb);
        }
        if (CoinRate != null && __isset.coinRate)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("CoinRate: ");
            CoinRate.ToString(sb);
        }
        if (CreditRate != null && __isset.creditRate)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("CreditRate: ");
            CreditRate.ToString(sb);
        }
        sb.Append(")");
        return(sb.ToString());
    }