public GetAllVendorsOutput GetAllVendors() { var vendors = _vendorRepository.GetAll().OrderBy(b => b.CreationTime); return(new GetAllVendorsOutput { Vendors = Mapper.Map <List <VendorDto> >(vendors) }); }
public async Task <IEnumerable <VendorDto> > GetAll() { try { var vendor = (await _vendorRepository.GetAll()).OrderBy(x => x.Name); var vendorDto = _mapper.Map <IEnumerable <Vendor>, IEnumerable <VendorDto> >(vendor); return(vendorDto); } catch (Exception e) { throw e; } }
public IViewComponentResult Invoke(ProductSearch search) { ViewBag.Vendors = _VendorRepo.GetAll(); ViewBag.Categories = _CategoryRepo.GetAll(); return(View(search)); }
public IEnumerable <VendorDto> GetAll() { var result = _vendorRepository.GetAll(); var mappedResult = _mapper.Map <IEnumerable <VendorDto> >(result); return(mappedResult); }
public List <Vendor> GetVendors(bool withMaterials, bool onlyActive = true) { var vendors = new List <Vendor>(); foreach (var vendor in _vendorRepository.GetAll(withMaterials, onlyActive)) { vendors.Add(Vendor.MapFromEntity(vendor)); } return(vendors); }
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)); }
public IActionResult Index() { var vendors = _vendorRepo.GetAll(); var model = new VendorsViewModel() { Vendors = vendors }; return(View(model)); }
public IActionResult Product(int?id = null) { ViewBag.Vendors = _VendorRepo.GetAll(); ViewBag.Categories = _CategoryRepo.GetAll(); var product = _ProductRepo.GetByID(id); ProductForm productForm; if (product != null) { productForm = ProductForm.FromModel(product); } else { productForm = new ProductForm(); } return(View(productForm)); }
public IActionResult PostTransaction([FromBody] TransactionForDisplay transaction) { var transactions = new List <TransactionForDisplay>(); if (transaction.TransactionId == null || transaction.TransactionId == Guid.Empty) { transaction.TransactionId = Guid.NewGuid(); } if (transaction.AccountId == null) { transaction.AccountId = _accountRepo.GetAll().Single(a => a.Name.Equals(transaction.AccountName, StringComparison.CurrentCultureIgnoreCase)).AccountId; } transaction.SetAmount(); transaction.EnteredDate = DateTime.Now; if (transaction.CategoryId.IsNullOrEmpty() && !string.IsNullOrWhiteSpace(transaction.CategoryName)) { var category = _categoryRepo.GetAll().SingleOrDefault(c => (c.Name.Equals(transaction.CategoryName, StringComparison.CurrentCultureIgnoreCase))); if (category == null) { category = new Category { CategoryId = Guid.NewGuid(), Name = transaction.CategoryName, Type = "Expenses" }; _categoryRepo.Insert(category); } transaction.CategoryId = category.CategoryId; } var bankFeeTransactions = TransactionHelpers.GetBankFeeTransactions(transaction, _categoryRepo, _accountRepo); transactions.Add(transaction); transactions.AddRange(bankFeeTransactions); foreach (var trx in transactions) { _transactionRepo.Insert(trx); } var accountBalances = _accountRepo.GetAccountBalances().Select(a => new { a.AccountId, a.CurrentBalance }); InvoiceForPosting invoice = null; if (transaction.InvoiceId.HasValue) { invoice = _invoiceRepo.Get(transaction.InvoiceId.Value); } var vendor = _vendorRepo.GetAll().SingleOrDefault(v => v.Name == transaction.Vendor); return(CreatedAtAction("PostTransaction", new { id = transaction.TransactionId }, new { transactions, accountBalances, invoice, vendor })); }
public async Task <ActionResult <List <Vendor> > > GetAsync() { List <Vendor> ToReturn = new List <Vendor>(); try { return(await _VendorRepo.GetAll(0)); } catch (Exception ex) { var logger = _loggerFactory.CreateLogger("internal_error_log"); logger.LogInformation("Problem happened in selecting the data for get all with message" + ex.Message); return(ToReturn); } }
public List <GridResultDTO> GetAll() { var data = _VendorRepository.GetAll(); var VendorDTO = data.Select(x => new GridResultDTO { Id = x.Id, VendorName = x.VendorName, Title = x.Title, IsDeleted = x.IsDeleted, Date = x.Date, Tag = _VendorRepository.GetAllTags(x.Id).Select(y => new TagDTO { Name = y.Name }).ToList() }).ToList(); return(VendorDTO); }
/// <summary> /// Gets all vendors /// </summary> /// <param name="name">Vendor name</param> /// <param name="pageIndex">Page index</param> /// <param name="pageSize">Page size</param> /// <param name="showHidden">A value indicating whether to show hidden records</param> /// <returns>Vendors</returns> public virtual IPagedList <Vendor> GetAllVendors(string name = "", int pageIndex = 0, int pageSize = int.MaxValue, bool showHidden = false) { var query = _vendorRepository.GetAll(); if (!String.IsNullOrWhiteSpace(name)) { query = query.Where(v => v.Name.Contains(name)); } if (!showHidden) { query = query.Where(v => v.Active); } query = query.Where(v => !v.Deleted); query = query.OrderBy(v => v.DisplayOrder).ThenBy(v => v.Name); var vendors = new PagedList <Vendor>(query, pageIndex, pageSize); return(vendors); }
public JsonResult Index() { var apiResult = TryExecute(() => _vendorRepository.GetAll(), "Vendors Fetched sucessfully"); return(Json(apiResult, JsonRequestBehavior.AllowGet)); }
public List <VendorDto> GetAllVendors(int pageSize = -1, int pageNo = -1) { return(repository.GetAll(pageSize, pageNo).ToList()); }
public IEnumerable <Vendor> GetAllVendors() { return(_vendorRepository.GetAll().Where(p => p.isDelete == false)); }
public IEnumerable <Vendor> GetVendors( ) { return(_vendorRepo.GetAll()); }
public IEnumerable <VendorDto> GetAll() { return(vendorRepository.GetAll().MappingDtos()); }
public async Task <ActionResult <VendorDTO> > GetVendors() { return(Ok(await _vendorRepository.GetAll())); }
public async Task <IActionResult> AllProducts([FromQuery] int pageSize = 25, [FromQuery] int pageIndex = 0) { var paginatedItems = await _vendorRepository.GetAll(pageSize, pageIndex); return(Ok(paginatedItems)); }
public IEnumerable <Vendor> GetAll() { return(_vendorRepository.GetAll()); }