public CyptoItem GetObjCyptoItem(long id) { try { CyptoItem ObjCyptoItem = db.CyptoItems.Find(id); return(ObjCyptoItem); } catch (Exception e) { return(null); } }
public async Task <int> UpdateCypto(CyptoItem ObjCyptoItem) { try { db.Entry(ObjCyptoItem).State = EntityState.Modified; return(await db.SaveChangesAsync()); } catch (Exception ex) { this.AddToExceptionLog("UpdateCypto", "Ctrl.CyptoItem", ex.ToString()); return(0); } }
public async Task <int> UpdateCyptoItem(CyptoItem ObjCyptoItem) { try { db.Entry(ObjCyptoItem).State = EntityState.Modified; int rs = await db.SaveChangesAsync(); return((int)EnumCore.Result.action_true); } catch (Exception ex) { return((int)EnumCore.Result.action_false); } }
public async Task <int> CreateCyptoItem(CyptoItem ObjCyptoItem) { try { db.CyptoItems.Add(ObjCyptoItem); await db.SaveChangesAsync(); return((int)EnumCore.Result.action_true); } catch (Exception e) { return((int)EnumCore.Result.action_false); } }
public async Task <ActionResult> EditCypto(CyptoItemViewModel model) { if (ModelState.IsValid) { CyptoItem ObjCyptoItem = cms_db.GetObjCyptoItem(model.id); ObjCyptoItem.is_active = model.is_active; ObjCyptoItem.allow_update = model.allow_update; int rs = await cms_db.UpdateCypto(ObjCyptoItem); return(RedirectToAction("EditCypto", new { id = model.id })); } return(RedirectToAction("Index")); }
public async Task <ActionResult> GetAndUpcateTableCyptoItem() { CoinMarketDataRespon coinmaketresult = await _client.GetListCyptoItemAsync(); foreach (CyproEntity Item in coinmaketresult.data) { CyptoItem objCyptoItem = new CyptoItem(); objCyptoItem.id = Item.id; objCyptoItem.name = Item.name; objCyptoItem.symbol = Item.symbol; objCyptoItem.slug = Item.slug; if (Item.is_active == 1) { objCyptoItem.is_active = true; } else { objCyptoItem.is_active = false; } try { objCyptoItem.first_historical_data = DateTime.Parse(Item.first_historical_data); } catch { objCyptoItem.first_historical_data = DateTime.Now; } try { objCyptoItem.last_historical_data = DateTime.Parse(Item.last_historical_data); } catch { objCyptoItem.last_historical_data = DateTime.Now; } await cms_db.CreateCyptoItem(objCyptoItem); } return(View()); }
public CyptoItemViewModel(CyptoItem model) { _MainObj = model; }
public CyptoItemViewModel() { _MainObj = new CyptoItem(); }