Example #1
0
        public GetAllVendorsOutput GetAllVendors()
        {
            var vendors = _vendorRepository.GetAll().OrderBy(b => b.CreationTime);

            return(new GetAllVendorsOutput
            {
                Vendors = Mapper.Map <List <VendorDto> >(vendors)
            });
        }
Example #2
0
 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);
        }
Example #5
0
        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);
        }
Example #6
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));
        }
        public IActionResult Index()
        {
            var vendors = _vendorRepo.GetAll();

            var model = new VendorsViewModel()
            {
                Vendors = vendors
            };

            return(View(model));
        }
Example #8
0
        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));
        }
Example #9
0
        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 }));
        }
Example #10
0
        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);
            }
        }
Example #11
0
        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);
        }
Example #12
0
        /// <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);
        }
Example #13
0
        public JsonResult Index()
        {
            var apiResult = TryExecute(() => _vendorRepository.GetAll(), "Vendors Fetched sucessfully");

            return(Json(apiResult, JsonRequestBehavior.AllowGet));
        }
Example #14
0
 public List <VendorDto> GetAllVendors(int pageSize = -1, int pageNo = -1)
 {
     return(repository.GetAll(pageSize, pageNo).ToList());
 }
Example #15
0
 public IEnumerable <Vendor> GetAllVendors()
 {
     return(_vendorRepository.GetAll().Where(p => p.isDelete == false));
 }
Example #16
0
 public IEnumerable <Vendor> GetVendors( )
 {
     return(_vendorRepo.GetAll());
 }
Example #17
0
 public IEnumerable <VendorDto> GetAll()
 {
     return(vendorRepository.GetAll().MappingDtos());
 }
Example #18
0
 public async Task <ActionResult <VendorDTO> > GetVendors()
 {
     return(Ok(await _vendorRepository.GetAll()));
 }
Example #19
0
        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());
 }