Esempio n. 1
0
        public async Task <long> DeletePost(long ID, string username)
        {
            long result = 0;

            if (db != null)
            {
                try
                {
                    var dealer = await db.Dealer.FirstOrDefaultAsync(x => x.Id == ID);

                    if (dealer != null)
                    {
                        dealer.Modified   = DateTime.Now;
                        dealer.ModifiedBy = username;
                        dealer.RowStatus  = false;
                        db.Dealer.Update(dealer);

                        result = await db.SaveChangesAsync();
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            return(result);
        }
Esempio n. 2
0
        public async Task <long> AddPost(AspNetRoleClaims model)
        {
            if (db != null)
            {
                //await db.AspNetRoleClaims.AddAsync(model);
                await db.SaveChangesAsync();

                return(model.Id);
            }

            return(0);
        }
Esempio n. 3
0
        public async Task <long> AddPost(UserProfile user)
        {
            if (db != null)
            {
                await db.UserProfile.AddAsync(user);

                await db.SaveChangesAsync();

                return(user.Id);
            }

            return(0);
        }
Esempio n. 4
0
        public async Task <long> AddPost(Role role)
        {
            if (db != null)
            {
                await db.Role.AddAsync(role);

                await db.SaveChangesAsync();

                return(role.Id);
            }

            return(0);
        }
Esempio n. 5
0
        public async Task <long> AddPost(Barang model)
        {
            if (db != null)
            {
                await db.Barang.AddAsync(model);

                await db.SaveChangesAsync();

                return(model.Id);
            }

            return(0);
        }
Esempio n. 6
0
            public async Task <string> AddPost(AspNetRoles model)
            {
                if (db != null)
                {
                    await db.AspNetRoles.AddAsync(model);

                    await db.SaveChangesAsync();

                    return(model.Id);
                }

                return("0");
            }
Esempio n. 7
0
        public async Task <long> Add(Warna model)
        {
            if (db != null)
            {
                await db.Warna.AddAsync(model);

                await db.SaveChangesAsync();

                return(model.Id);
            }

            return(0);
        }
Esempio n. 8
0
        public async Task <long> SubmitCMS(CMSRequest model)
        {
            if (db != null)
            {
                using (var scope = new TransactionScope(TransactionScopeOption.Required, TransactionScopeAsyncFlowOption.Enabled))
                {
                    try
                    {
                        foreach (var item in model.List_CMSMaster)
                        {
                            CmsmasterData data = db.CmsmasterData.Where(x => x.RowStatus == true && x.Description == item.Description).First();
                            data.Value = item.Value;
                            await db.SaveChangesAsync();
                        }
                    }
                    catch (Exception ex)
                    {
                        scope.Dispose();

                        throw ex;
                    }
                    scope.Complete();
                }


                return(1);
            }

            return(0);
        }
Esempio n. 9
0
        public async Task <long> SaveUserDetail(UserDetail detail)
        {
            if (db != null)
            {
                try
                {
                    await db.UserDetail.AddAsync(detail);

                    await db.SaveChangesAsync();

                    return(detail.Id);
                }
                catch (Exception)
                {
                    return(0);
                }
            }
            return(0);
        }
Esempio n. 10
0
        public async Task <long> AddPost(Provinsi request)
        {
            long result = 0;


            if (db != null)
            {
                try
                {
                    await db.Provinsi.AddAsync(request);

                    result = await db.SaveChangesAsync();
                }
                catch (Exception)
                {
                    result = 0;
                }
            }
            return(result);
        }
Esempio n. 11
0
        public async Task <long> AddPost(Kota request)
        {
            long result = 0;

            if (db != null)
            {
                try
                {
                    await db.Kota.AddAsync(request);

                    result = await db.SaveChangesAsync();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }

            return(result);
        }
Esempio n. 12
0
        public async Task <NegoBarangResponse> AddPost(NegoBarangRequest model)
        {
            NegoBarangResponse response = new NegoBarangResponse();


            if (db != null)
            {
                try
                {
                    NegoBarang negoBarang = new NegoBarang();

                    negoBarang.UserProfileId = db.UserProfile.Where(x => x.RowStatus == true && x.Email == model.UserName).Select(x => x.Id).FirstOrDefaultAsync().Result;
                    negoBarang.BarangId      = model.BarangID;
                    negoBarang.TypePenawaran = model.TypePenawaran;
                    negoBarang.Harga         = model.Harga;
                    negoBarang.Created       = DateTime.Now;
                    negoBarang.CreatedBy     = model.UserName;
                    negoBarang.RowStatus     = true;

                    await db.NegoBarang.AddAsync(negoBarang);

                    await db.SaveChangesAsync();
                }
                catch (Exception ex)
                {
                    response.IsSuccess = false;
                    response.Message   = ex.ToString();
                }
            }


            return(response);
        }
Esempio n. 13
0
        public async Task <long> SaveTransactionJournal(TransactionJournal model)
        {
            if (db != null)
            {
                await db.TransactionJournal.AddAsync(model);

                await db.SaveChangesAsync();

                return(model.Id);
            }

            return(0);
        }
Esempio n. 14
0
        public async Task <long> Add(Merk merk)
        {
            if (db != null)
            {
                await db.Merk.AddAsync(merk);

                await db.SaveChangesAsync();

                return(merk.Id);
            }

            return(0);
        }
Esempio n. 15
0
        public async Task <long> Save(UserProfile user)
        {
            long result = 0;

            if (db != null)
            {
                try
                {
                    await db.UserProfile.AddAsync(user);

                    result = await db.SaveChangesAsync();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }

            return(result);
        }
Esempio n. 16
0
        public async Task <long> SaveTransaction(Transaction model)
        {
            long TransactionID = 0;

            if (db != null)
            {
                try
                {
                    await db.Transaction.AddAsync(model);

                    await db.SaveChangesAsync();

                    TransactionID = model.Id;
                }
                catch (Exception)
                {
                    return(0);
                }
            }
            return(TransactionID);
        }