Пример #1
0
 internal void UpdateStock(AdminStocksModel adminStockModel)
 {
     StockService.UpdateStock(new StockModel()
     {
         Id = adminStockModel.Id, active = adminStockModel.active, description = adminStockModel.description, market_id = adminStockModel.market_id, name = adminStockModel.name, symbol = adminStockModel.symbol, type_id = adminStockModel.type_id
     });
 }
Пример #2
0
 internal void SaveNewStock(AdminStocksModel adminStockModel)
 {
     StockService.CreateStock(new StockModel()
     {
         active = adminStockModel.active, description = "<p class=\"align-left\" style=\"text-align:justify\">" + adminStockModel.description + "</p>", market_id = adminStockModel.market_id, name = adminStockModel.name, symbol = adminStockModel.symbol, type_id = adminStockModel.type_id
     });
 }
Пример #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            AdminStocksModel adminStockModel = db.GetStocks().Where(s => s.Id == id).FirstOrDefault();

            //db.DeleteStock(adminStockModel);
            return(RedirectToAction("Index"));
        }
Пример #4
0
        public ActionResult Edit([Bind(Include = "Id,symbol,name,market_id,type_id,description,active")] AdminStocksModel adminStockModel)
        {
            if (ModelState.IsValid && !db.GetStocks().Any(s => s.market_id == adminStockModel.market_id && s.symbol == adminStockModel.symbol && s.Id != adminStockModel.Id))
            {
                db.UpdateStock(adminStockModel);
                return(RedirectToAction("Index"));
            }

            ViewBag.ErrorMessage = "Invalid Stock Data";
            return(View(adminStockModel));
        }
Пример #5
0
        // GET: AdminStocks/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AdminStocksModel adminStockModel = db.GetStocks().Where(s => s.Id == id).FirstOrDefault();

            if (adminStockModel == null)
            {
                return(HttpNotFound());
            }
            return(View(adminStockModel));
        }
Пример #6
0
 internal void DeleteStock(AdminStocksModel adminStockModel)
 {
     StockService.DeleteStock(adminStockModel.Id);
 }