public void CanCreateMoneyCurrency()
        {
            MoneyCurrency moneyCurrency = new MoneyCurrency(20.25m);

            Assert.Equal(20.25m, moneyCurrency.Value);
            Assert.Equal("$", moneyCurrency.Currency);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, MoneyCurrency moneyCurrency)
        {
            if (id != moneyCurrency.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(moneyCurrency);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MoneyCurrencyExists(moneyCurrency.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(moneyCurrency));
        }
Exemplo n.º 3
0
        public JsonResult SaveAndUpdateCurrency(int itemID, string idName, string idCode, string idBuying, string idSelling, string idReception, string idSales)
        {
            var result = new jsonMessage();

            try
            {
                MoneyCurrency currency = new MoneyCurrency();
                currency.Id                  = itemID;
                currency.Name                = idName;
                currency.Code                = idCode;
                currency.Exchange_Buying     = idBuying;
                currency.Exchange_Selling    = idSelling;
                currency.Effective_Reception = idReception;
                currency.Effective_Sales     = idSales;
                currency.Date                = DateTime.Now;
                db.Entry(currency).State     = EntityState.Modified;
                result.Message               = "Başarıyla Güncelleştirildi...";
                result.Status                = true;
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                result.Status  = false;
                result.Message = "İşlem Başarısız Tekrar Deneyiniz";
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
 public PriceResult(string title, int upc, MoneyCurrency baseAmount, decimal taxRate, MoneyCurrency afterTax)
 {
     Title      = title;
     Upc        = upc;
     BaseAmount = baseAmount;
     TaxRate    = taxRate;
     AfterTax   = afterTax;
 }
Exemplo n.º 5
0
        public async Task <IActionResult> Create(MoneyCurrency moneyCurrency)
        {
            if (ModelState.IsValid)
            {
                _context.Add(moneyCurrency);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(moneyCurrency));
        }