예제 #1
0
        // GET: Share/Edit/5
        public IActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var sharePrice = _shareService.GetById(id);

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

            return(View(sharePrice));
        }
예제 #2
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            share a = shse.GetById(id);

            a.amountInvested = float.Parse(collection["amountInvested"]);
            a.idBroker       = int.Parse(collection["idBroker"]);
            // Convert.ChangeType(collection["broker"], typeof(broker));
            a.currency1      = collection["currency1"];
            a.currency2      = collection["currency2"];
            a.dateOfPurchase = Convert.ToDateTime(collection["dateOfPurchase"]);
            a.dateOfSale     = Convert.ToDateTime(collection["dateOfSale"]);
            a.gain           = float.Parse(collection["gain"]);

            shse.UpdateShare(a);

            try
            {
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View(a));
            }
        }