public async Task <string> AddUpdateAdvance(AdvanceDomainModel advance)
        {
            string status    = "";
            int    condition = 0;

            if (condition > 0)
            {
                List <tblAdvance> uList = new List <tblAdvance>();
                uList = await advanceRepository.GetAll();
            }

            int    vrNo     = 0;
            string strVchNo = "";

            using (abuhamzapetstoreEntities db = new abuhamzapetstoreEntities())
            {
                try
                {
                    vrNo = (from c in db.tblvches
                            orderby c.vch_id descending
                            select c.vch_id).Take(1).SingleOrDefault();

                    strVchNo = "0000" + (vrNo + 1);

                    var result = db.stpAdvance(advance.amount, advance.barcode, advance.description, advance.cus_No, strVchNo, DateTime.Now, advance.cus_Name);
                }
                catch (Exception ex)
                {
                    status = ex.Message;
                }
            }

            return(status);
        }
        public async Task <string> AddUpdateAdvance(AdvanceVM advanceVM)
        {
            AdvanceDomainModel advanceDM = new AdvanceDomainModel();

            AutoMapper.Mapper.Map(advanceVM, advanceDM);
            return(await advanceBusiness.AddUpdateAdvance(advanceDM));
        }
        public async Task <AdvanceToReturnVM> GetAdvanceByVoucherNo(string voucherNo)
        {
            AdvanceToReturnVM  advanceToReturnVM  = new AdvanceToReturnVM();
            AdvanceDomainModel advanceDomainModel = await advanceBusiness.GetAdvanceByVoucherNo(voucherNo);

            AutoMapper.Mapper.Map(advanceDomainModel, advanceToReturnVM);
            return(advanceToReturnVM);
        }
        public async Task <AdvanceToReturnVM> GetAdvanceById(int id)
        {
            AdvanceToReturnVM  advanceToReturnVM  = new AdvanceToReturnVM();
            AdvanceDomainModel advanceDomainModel = await advanceBusiness.GetAdvanceById(id);

            AutoMapper.Mapper.Map(advanceDomainModel, advanceToReturnVM);
            return(advanceToReturnVM);
        }
        public async Task <AdvanceDomainModel> GetAdvanceByVoucherNo(string voucherno)
        {
            AdvanceDomainModel advance = new AdvanceDomainModel();
            var model = await advanceRepository.SingleOrDefault(a => a.voucherNo == voucherno);

            if (model != null)
            {
                advance.amount      = model.amount;
                advance.barcode     = model.barcode;
                advance.cus_id      = model.cus_id;
                advance.cus_No      = model.cus_No;
                advance.description = model.description;
            }
            return(advance);
        }