public JsonResult ShowSo(int id) { HeThongSoViewModels hs = new HeThongSoViewModels(); hs.ManHinhID = id; var xp = Mapper.Map <HeThongSoViewModels, HeThongSo>(hs); HeThongSo heThongSo = db.HeThongSos.Where(x => x.ManHinhID == xp.ManHinhID && !x.Goi).OrderBy(x => x.STT).FirstOrDefault(); if (heThongSo == null) { heThongSo = db.HeThongSos.Where(x => x.ManHinhID == xp.ManHinhID).OrderByDescending(x => x.STT).FirstOrDefault(); } else { heThongSo.Goi = true; db.Entry(heThongSo).State = EntityState.Modified; db.SaveChanges(); heThongSo = db.HeThongSos.Where(x => x.ManHinhID == xp.ManHinhID && !x.Goi).OrderBy(x => x.STT).FirstOrDefault(); } if (heThongSo == null) { heThongSo = db.HeThongSos.Where(x => x.ManHinhID == xp.ManHinhID).OrderByDescending(x => x.STT).FirstOrDefault(); } return(Json(heThongSo, JsonRequestBehavior.AllowGet)); }
public HeThongSo GetAllStocks(int id) { HeThongSoViewModels hs = new HeThongSoViewModels(); hs.ManHinhID = id; var xp = Mapper.Map <HeThongSoViewModels, HeThongSo>(hs); HeThongSo heThongSo = db.HeThongSos.Where(x => x.ManHinhID == xp.ManHinhID && !x.Goi).OrderBy(x => x.STT).FirstOrDefault(); return(heThongSo); }
// GET: HeThongSoes/Details/5 public ActionResult ViewDetails(int id) { HeThongSoViewModels hs = new HeThongSoViewModels(); hs.ManHinhID = id; var xp = Mapper.Map <HeThongSoViewModels, HeThongSo>(hs); HeThongSo heThongSo = db.HeThongSos.Where(x => x.ManHinhID == xp.ManHinhID && !x.Goi).OrderBy(x => x.STT).FirstOrDefault(); if (heThongSo == null) { heThongSo = db.HeThongSos.Where(x => x.ManHinhID == xp.ManHinhID).OrderByDescending(x => x.STT).FirstOrDefault(); } return(View(heThongSo)); }
public JsonResult Show(int id) { HeThongSoViewModels hs = new HeThongSoViewModels(); hs.ManHinhID = id; var xp = Mapper.Map <HeThongSoViewModels, HeThongSo>(hs); HeThongSo heThongSo = db.HeThongSos.Where(x => x.ManHinhID == xp.ManHinhID && !x.Goi).OrderBy(x => x.STT).FirstOrDefault(); if (heThongSo == null) { heThongSo = db.HeThongSos.Where(x => x.ManHinhID == xp.ManHinhID).OrderByDescending(x => x.STT).FirstOrDefault(); } return(Json(heThongSo, JsonRequestBehavior.AllowGet)); }