Ejemplo n.º 1
0
        public JsonResult AracKayit(cars formdata)
        {
            int sonuc = 1;

            if (Helpers.Kullanici.GirisKontrol())
            {
                try
                {
                    rentacarEntities db        = new rentacarEntities();
                    cars             YeniKayit = new cars();
                    YeniKayit.brand     = formdata.brand;
                    YeniKayit.color     = formdata.color;
                    YeniKayit.img       = formdata.img;
                    YeniKayit.km        = formdata.km;
                    YeniKayit.model     = formdata.model;
                    YeniKayit.modelyear = formdata.modelyear;
                    YeniKayit.period    = formdata.period;
                    YeniKayit.price     = formdata.price;
                    YeniKayit.title     = formdata.title;
                    db.cars.Add(YeniKayit);
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    sonuc = 0;
                }
            }
            else
            {
                sonuc = 2;
            }
            return(Json(sonuc));
        }
Ejemplo n.º 2
0
        public JsonResult YoneticiEkle(admins formdata)
        {
            int sonuc = 1;

            if (Helpers.Kullanici.GirisKontrol())
            {
                try
                {
                    rentacarEntities db        = new rentacarEntities();
                    admins           YeniKayit = new admins();
                    YeniKayit.name     = formdata.name;
                    YeniKayit.username = formdata.username;
                    YeniKayit.password = formdata.password;
                    db.admins.Add(YeniKayit);
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    sonuc = 0;
                }
            }
            else
            {
                sonuc = 2;
            }
            return(Json(sonuc));
        }
Ejemplo n.º 3
0
        public JsonResult YoneticiDuzenle(admins formdata)
        {
            int sonuc = 1;

            if (Helpers.Kullanici.GirisKontrol())
            {
                try
                {
                    rentacarEntities db  = new rentacarEntities();
                    admins           bul = db.admins.Where(w => w.id == formdata.id).FirstOrDefault();
                    if (bul == null)
                    {
                        sonuc = 3;
                        return(Json(sonuc));
                    }
                    bul.name     = formdata.name;
                    bul.username = formdata.username;
                    bul.password = formdata.password;
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    sonuc = 0;
                }
            }
            else
            {
                sonuc = 2;
            }
            return(Json(sonuc));
        }
Ejemplo n.º 4
0
        public JsonResult DuyuruEkle(announcements formdata)
        {
            int sonuc = 1;

            if (Helpers.Kullanici.GirisKontrol())
            {
                try
                {
                    rentacarEntities db        = new rentacarEntities();
                    announcements    YeniKayit = new announcements();
                    YeniKayit.title       = formdata.title;
                    YeniKayit.description = formdata.description;
                    db.announcements.Add(YeniKayit);
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    sonuc = 0;
                }
            }
            else
            {
                sonuc = 2;
            }
            return(Json(sonuc));
        }
Ejemplo n.º 5
0
        public JsonResult DuyuruDuzenle(announcements formdata)
        {
            int sonuc = 1;

            if (Helpers.Kullanici.GirisKontrol())
            {
                try
                {
                    rentacarEntities db  = new rentacarEntities();
                    announcements    bul = db.announcements.Where(w => w.id == formdata.id).FirstOrDefault();
                    if (bul == null)
                    {
                        sonuc = 3;
                        return(Json(sonuc));
                    }
                    bul.title       = formdata.title;
                    bul.description = formdata.description;
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    sonuc = 0;
                }
            }
            else
            {
                sonuc = 2;
            }
            return(Json(sonuc));
        }
Ejemplo n.º 6
0
        public JsonResult DuyuruSil(int id)
        {
            int sonuc = 1;

            if (Helpers.Kullanici.GirisKontrol())
            {
                try
                {
                    rentacarEntities db = new rentacarEntities();
                    var bul             = db.announcements.Where(w => w.id == id).FirstOrDefault();
                    if (bul == null)
                    {
                        sonuc = 3;
                        return(Json(sonuc));
                    }
                    db.announcements.Remove(bul);
                    db.SaveChanges();
                }
                catch (Exception)
                {
                    sonuc = 0;
                    throw;
                }
            }
            else
            {
                sonuc = 2;
            }
            return(Json(sonuc));
        }
Ejemplo n.º 7
0
        public JsonResult RezervasyonIslem(reservations formdata)
        {
            int sonuc = 1;

            if (Helpers.Kullanici.GirisKontrol())
            {
                try
                {
                    rentacarEntities db  = new rentacarEntities();
                    reservations     bul = db.reservations.Where(w => w.id == formdata.id).FirstOrDefault();
                    if (bul == null)
                    {
                        sonuc = 3;
                        return(Json(sonuc));
                    }
                    bul.reservationadminnot = formdata.reservationadminnot;
                    bul.reservationnot      = formdata.reservationnot;
                    bul.isclose             = formdata.isclose;
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    sonuc = 0;
                }
            }
            else
            {
                sonuc = 2;
            }
            return(Json(sonuc));
        }
Ejemplo n.º 8
0
        // GET: Islem
        public JsonResult Kayit(reservations formdata)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();
            string RezervasyonKodu          = Random(6);
            bool   sonuc = true;

            try
            {
                rentacarEntities db        = new rentacarEntities();
                reservations     YeniKayit = new reservations();
                YeniKayit.cars            = formdata.cars;
                YeniKayit.city            = formdata.city;
                YeniKayit.email           = formdata.email;
                YeniKayit.isclose         = false;
                YeniKayit.name            = formdata.name;
                YeniKayit.phone           = formdata.phone;
                YeniKayit.reservationtime = formdata.reservationtime;
                YeniKayit.reservationcode = RezervasyonKodu;
                db.reservations.Add(YeniKayit);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                sonuc = false;
            }
            dic["sonuc"]           = sonuc;
            dic["rezervasyonkodu"] = RezervasyonKodu;
            return(Json(dic));
        }
Ejemplo n.º 9
0
        public static bool Giris(string username, string password)
        {
            bool sonuc = false;

            rentacarEntities db = new rentacarEntities();
            var kontrol         = db.admins.Where(w => w.username == username & w.password == password).FirstOrDefault();

            if (kontrol != null)
            {
                var token = Guid.NewGuid();
                sonuc = true;
                HttpCookie cookie = new HttpCookie("rentacaryonetici");
                cookie["Token"] = token.ToString();
                cookie.Expires  = DateTime.Now.AddDays(1);
                HttpContext.Current.Response.Cookies.Add(cookie);
                kontrol.token = token.ToString();
                db.SaveChanges();
            }
            return(sonuc);
        }
Ejemplo n.º 10
0
        public JsonResult AracDuzenle(cars formdata)
        {
            int sonuc = 1;

            if (Helpers.Kullanici.GirisKontrol())
            {
                try
                {
                    rentacarEntities db  = new rentacarEntities();
                    cars             bul = db.cars.Where(w => w.id == formdata.id).FirstOrDefault();
                    if (bul == null)
                    {
                        sonuc = 3;
                        return(Json(sonuc));
                    }
                    bul.brand     = formdata.brand;
                    bul.color     = formdata.color;
                    bul.img       = formdata.img;
                    bul.km        = formdata.km;
                    bul.model     = formdata.model;
                    bul.modelyear = formdata.modelyear;
                    bul.period    = formdata.period;
                    bul.price     = formdata.price;
                    bul.title     = formdata.title;
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    sonuc = 0;
                }
            }
            else
            {
                sonuc = 2;
            }
            return(Json(sonuc));
        }