Esempio n. 1
0
        public async Task <bool> BayiOlustur(BayiAddViewModel model)
        {
            var result  = false;
            var kontrol = await context.Bayiler
                          .Where(x => x.IsActive && !x.IsDelete && x.Eposta == model.Eposta)
                          .FirstOrDefaultAsync();

            if (kontrol != null)
            {
                result = false;
            }
            else
            {
                var bayi = new Bayiler()
                {
                    IsActive  = model.IsActive,
                    IsDelete  = model.IsDelete,
                    Adresi    = model.Adres,
                    Eposta    = model.Eposta,
                    IlceId    = model.IlceId,
                    SehirId   = model.SehirId,
                    Telefon   = model.Telefon,
                    SirketAdi = model.SirketAdi
                };
                context.Bayiler.Add(bayi);
                await context.SaveChangesAsync();

                result = true;
                ProjeHub.GetBayiData();
            }

            return(result);
        }
Esempio n. 2
0
        public async Task <bool> BayiGüncelle(BayiUpdateViewModel model)
        {
            var result = false;
            var data   = await context.Bayiler.FirstOrDefaultAsync(x => x.Id == model.Id);

            if (data != null)
            {
                data.IsActive  = model.IsActive;
                data.IsDelete  = model.IsDelete;
                data.Eposta    = model.Eposta;
                data.Adresi    = model.Adres;
                data.Telefon   = model.Telefon;
                data.SehirId   = model.SehirId;
                data.IlceId    = model.IlceId;
                data.SirketAdi = model.SirketAdi;
                await context.SaveChangesAsync();

                result = true;
                ProjeHub.GetBayiData();
            }
            else
            {
                result = false;
            }

            return(result);
        }
Esempio n. 3
0
        public async Task <bool> BayiSil(int Id)
        {
            var data = await context.Bayiler.FirstOrDefaultAsync(x => x.Id == Id);

            if (data != null)
            {
                data.IsDelete = true;
                data.IsActive = false;
                await context.SaveChangesAsync();

                ProjeHub.GetBayiData();
                return(true);
            }

            return(false);
        }