Beispiel #1
0
        public async Task <bool> AddAsync(TxnItemFormula entity)
        {
            using (EkalContext dbContext = new EkalContext())
            {
                try
                {
                    await dbContext.TxnItemFormula.AddAsync(entity);

                    dbContext.SaveChanges();
                    return(true);
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.ToString());
                }
            }
        }
        public async Task <bool> AddRangeAsync(List <TxnItemFormulaDetails> entities)
        {
            using (EkalContext dbContext = new EkalContext())
            {
                try
                {
                    await dbContext.TxnItemFormulaDetails.AddRangeAsync(entities);

                    dbContext.SaveChanges();
                    return(true);
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.ToString());
                }
            }
        }
        public async Task <bool> AddAsync(TxnCustomerDeliveryAddress entity)
        {
            using (EkalContext dbContext = new EkalContext())
            {
                try
                {
                    await dbContext.TxnCustomerDeliveryAddress.AddAsync(entity);

                    dbContext.SaveChanges();
                    return(true);
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.ToString());
                }
            }
        }
        public async Task <bool> AddAsync(MstVolunteerType entity)
        {
            using (EkalContext dbContext = new EkalContext())
            {
                try
                {
                    await dbContext.MstVolunteerType.AddAsync(entity);

                    dbContext.SaveChanges();
                    return(true);
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.ToString());
                }
            }
        }
Beispiel #5
0
        public async Task <bool> DeleteAsync(int id)
        {
            using (EkalContext dbContext = new EkalContext())
            {
                try
                {
                    var tmpRecord = await dbContext.TxnItemFormula.Where(x => x.ItemFormulaId == id).FirstOrDefaultAsync();

                    dbContext.TxnItemFormula.Remove(tmpRecord);
                    dbContext.SaveChanges();
                    return(true);
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.ToString());
                }
            }
        }
Beispiel #6
0
        public async Task <bool> DeleteAsync(string code)
        {
            using (EkalContext dbContext = new EkalContext())
            {
                try
                {
                    var tmpRecord = await dbContext.MstDistricts.Where(x => x.DistrictCode == code).FirstOrDefaultAsync();

                    dbContext.MstDistricts.Remove(tmpRecord);
                    dbContext.SaveChanges();
                    return(true);
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.ToString());
                }
            }
        }
Beispiel #7
0
        public async Task <bool> AddAsync(TxnCustomer entity)
        {
            using (EkalContext dbContext = new EkalContext())
            {
                try
                {
                    entity.CreatedDate = DateTime.Now;
                    entity.CreatedBy   = Common.UserProfileID;
                    await dbContext.TxnCustomer.AddAsync(entity);

                    dbContext.SaveChanges();
                    return(true);
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.ToString());
                }
            }
        }