예제 #1
0
        public ActionResult Edit(int id)
        {
            var asset = _assetRepository.Get(id);

            ViewBag.AllocatedUserId = new SelectList(_userRepository.GetAll("Person"), "Id", "Person.Name", asset.AllocatedEmployeeId);
            ViewBag.AssetCategoryId = new SelectList(_assetCategoryRepository.GetAll(), "Id", "Title", asset.AssetCategoryId);
            ViewBag.DepartmentId    = new SelectList(_departmentRepository.GetAll(), "Id", "Title", asset.DepartmentId);
            ViewBag.VendorId        = new SelectList(_vendorRepository.GetAll(), "Id", "Title", asset.VendorId);

            return(View(asset));
        }
예제 #2
0
        public async Task <PaginatedList <AssetCategoryDto> > PaginationAsync(SieveModel model, Expression <Func <AssetCategory, bool> > predicate = null)
        {
            var entities = _assetCategoryRepository.GetAll(predicate);
            var count    = await _sieveProcessor.Apply(model, entities, applyPagination : false).CountAsync();

            var result = _sieveProcessor.Apply(model, entities)
                         .ProjectTo <AssetCategoryDto>(_mapper.ConfigurationProvider);
            var pagination = await result.ToListAsync();

            return(new PaginatedList <AssetCategoryDto>(
                       _sieveOptions, model.Page, model.PageSize, count, pagination));
        }
예제 #3
0
        public JsonResult Index()
        {
            var apiResult = TryExecute(() => _assetCategoryRepository.GetAll(), "Asset Categories Fetched sucessfully");

            return(Json(apiResult, JsonRequestBehavior.AllowGet));
        }
예제 #4
0
        public ActionResult Index()
        {
            var assetCategories = _assetCategoryRepository.GetAll();

            return(View(assetCategories.ToList()));
        }