// GET: api/Araba/5
        public IHttpActionResult Get(int id)
        {
            ResponseContent <Araba> content;

            using (var ArabaBusiness = new ArabaBusiness())
            {
                List <Araba> araba = null;
                try
                {
                    var c = ArabaBusiness.SelectedIdAraba(id);
                    if (c != null)
                    {
                        araba = new List <Araba>();
                        araba.Add(c);
                    }
                    content = new ResponseContent <Araba>(araba);

                    return(new XmlResult <Araba>(content, Request));
                }
                catch (Exception)
                {
                    content = new ResponseContent <Araba>(null);
                    return(new XmlResult <Araba>(content, Request));
                }
            }
        }
예제 #2
0
 private bool UpdateAraba(int id, string marka, string model, string arabatipi, int arabaninkmsi, string aciklama, byte ehliyet, int gunlukkmsiniri, int gunlukkirafiyati, bool kiralimi, DateTime kirabaslangic, DateTime kirabitis, int musteriid, int sirketid)
 {
     try
     {
         using (var ArabaBussines = new ArabaBusiness())
         {
             return(ArabaBussines.UpdateAraba(new Araba()
             {
                 ArabaID = id,
                 Marka = marka,
                 Model = model,
                 ArabaTipi = arabatipi,
                 ArabaninKmsi = arabaninkmsi,
                 Aciklama = aciklama,
                 Ehliyet = ehliyet,
                 GunlukKmSiniri = gunlukkmsiniri,
                 GunlukKiraFiyati = gunlukkirafiyati,
                 KiraliMi = kiralimi,
                 KiraBaslangic = kirabaslangic,
                 KiraBitis = kirabitis,
                 MusteriID = musteriid,
                 SirketID = sirketid
             }));
         }
     }
     catch (Exception ex)
     {
         LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true);
         throw new Exception("Araba doesn't exists.");
     }
 }
 // PUT: api/Araba/5
 public IHttpActionResult Put(Araba araba)
 {
     using (var ArabaBusiness = new ArabaBusiness())
     {
         ArabaBusiness.UpdateAraba(araba);
         return(null);
     }
 }
 // GET: api/Araba
 public IHttpActionResult Get()
 {
     using (var ArabaBusiness = new ArabaBusiness())
     {
         List <Araba> AraList = ArabaBusiness.SelectAllAraba();
         var          content = new ResponseContent <Araba>(AraList);
         return(new StandartResults <Araba>(content, Request));
     }
 }
예제 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            ArabaSurragate arabilgi = new ArabaSurragate();

            arabilgi.AlindigiTarih = dateTimePicker1.Value;


            ArabaBusiness.ekle(arabilgi);
        }
        // DELETE: api/Araba/5
        public IHttpActionResult Delete(int id)
        {
            //ResponseContent<Kullanici> content;

            using (var ArabaBusiness = new ArabaBusiness())
            {
                ArabaBusiness.ArabaDelete(id);
                return(null);
            }
        }
 public Araba[] SelectAllAraba()
 {
     try
     {
         using (var business = new ArabaBusiness())
         {
             return(business.SelectAllAraba().ToArray());
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
 public bool InsertAraba(Araba entity)
 {
     try
     {
         using (var business = new ArabaBusiness())
         {
             business.InsertAraba(entity);
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
예제 #9
0
 private Araba SelectArabaByID(int ID)
 {
     try
     {
         using (var ArabaBussines = new ArabaBusiness())
         {
             return(ArabaBussines.SelectArabaById(ID));
         }
     }
     catch (Exception ex)
     {
         LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true);
         throw new Exception("Araba doesn't exists.");
     }
 }
예제 #10
0
 private List <Araba> ListAllAraba()
 {
     try
     {
         using (var ArabaBussines = new ArabaBusiness())
         {
             List <Araba> Araba = ArabaBussines.SelectAllAraba();
             return(Araba);
         }
     }
     catch (Exception ex)
     {
         LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true);
         throw new Exception("Araba doesn't exists.");
     }
 }
        // POST: api/Araba
        public IHttpActionResult Post(Araba araba)
        {
            var content = new ResponseContent <Araba>(null);

            if (araba != null)
            {
                using (var ArabaBusiness = new ArabaBusiness())
                {
                    content.Result = ArabaBusiness.InsertAraba(araba) ? "1" : "0";

                    return(new StandartResults <Araba>(content, Request));
                }
            }
            content.Result = "0";

            return(new StandartResults <Araba>(content, Request));
        }