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 }); }
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 }); }
public ActionResult DeleteConfirmed(int id) { AdminStocksModel adminStockModel = db.GetStocks().Where(s => s.Id == id).FirstOrDefault(); //db.DeleteStock(adminStockModel); return(RedirectToAction("Index")); }
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)); }
// 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)); }
internal void DeleteStock(AdminStocksModel adminStockModel) { StockService.DeleteStock(adminStockModel.Id); }