Exemplo n.º 1
0
        public void ActionAdd(ModInfoMedicalModel model)
        {
            _item = model.RecordID > 0 ? ModInfoMedicalService.Instance.GetByID(model.RecordID) : new ModInfoMedicalEntity();

            ViewBag.Data  = _item;
            ViewBag.Model = model;
        }
Exemplo n.º 2
0
        public void ActionIndex(ModInfoMedicalModel model)
        {
            //sap xep tu dong
            string orderBy = AutoSort(model.Sort);

            //tao danh sach
            var dbQuery = ModInfoMedicalService.Instance.CreateQuery()
                          .Where(!string.IsNullOrEmpty(model.keyword), o => o.Name.Contains(model.keyword) || o.Phone.Contains(model.keyword))
                          .Where(model.StartDate > DateTime.MinValue, o => o.DateCreated >= model.StartDate)
                          .Where(model.EndDate > DateTime.MinValue, o => o.DateCreated <= model.EndDate)
                          .Take(model.PageSize)
                          .OrderBy(orderBy)
                          .Skip(model.PageIndex * model.PageSize);

            ViewBag.Data      = dbQuery.ToList();
            model.TotalRecord = dbQuery.TotalRecord;
            ViewBag.Model     = model;
        }