Example #1
0
        public List <C_DeviceType> GetDeviceTypes()
        {
            if (_cachedDeviceTypes != null)
            {
                return(_cachedDeviceTypes);
            }

            return(_cachedDeviceTypes = _deviceTypeService.GetDeviceTypes());
        }
        public ActionResult GetDeviceTypes(int draw, int start, int length)
        {
            var currentUser = Session["UserData"] as CustomPrincipalSerializeModel;

            //    if (distributorId != null && distributorId != "" && distributorId != 0.ToString())
            try
            {
                if (start < 1)
                {
                    start = 1;
                }
                else
                {
                    start = (start / length) + 1;
                }

                var devicetype   = devicetypeService.GetDeviceTypes(start, length);
                var vehiclesData = Mapper.Map <List <DeviceType>, List <DeviceTypeViewModel> >(devicetype.Items).Select(Vehicle => new { Vehicle.DeviceTypeId, Vehicle.DeviceModel_Type });

                return(Json(new
                {
                    draw = draw,
                    recordsTotal = devicetype.TotalItems,
                    recordsFiltered = devicetype.TotalItems,
                    data = vehiclesData
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
            }
            return(Json(new
            {
                draw = draw,
                recordsTotal = 0,
                recordsFiltered = 0,
                data = new DeviceModelViewModel()
            }, JsonRequestBehavior.AllowGet));
        }
 public List <DeviceTypeModel> GetTypes()
 {
     return(deviceTypeService.GetDeviceTypes());
 }