예제 #1
0
        public IHttpActionResult GetAllData()
        {
            var    result        = new TransferObj <List <ChoiceObject> >();
            var    unitCode      = _service.GetCurrentUnitCode();
            string ParenUnitCode = _service.GetParentUnitCode(unitCode);
            string UnitCodeParam = string.IsNullOrEmpty(ParenUnitCode) ? unitCode : ParenUnitCode;

            result.Data = _service.Repository.DbSet.Where(x => x.TRANGTHAI == (int)TypeState.USED && x.UNITCODE.StartsWith(UnitCodeParam)).OrderBy(x => x.MANHACUNGCAP).Select(x => new ChoiceObject {
                VALUE = x.MANHACUNGCAP, TEXT = x.MANHACUNGCAP + " | " + x.TENNHACUNGCAP, DESCRIPTION = x.TENNHACUNGCAP, EXTEND_VALUE = x.DIACHI, PARENT = x.DIENTHOAI, ID = x.ID
            }).ToList();
            if (result.Data.Count > 0)
            {
                result.Status = true;
            }
            else
            {
                result.Status = false;
            }
            return(Ok(result));
        }