Exemple #1
0
        //[AutFilter]
        public ActionResult Create(Arac data)
        {
            #region Ekleme
            try
            {
                if (ModelState.IsValid)
                {
                    ViewBag.MarkaGetir = db.Marka.ToList();
                    ViewBag.ModelGetir = db.Model.ToList();
                    ViewBag.TipGetir   = db.Tip.ToList();
                    if (db.Arac.Any(x => x.Plaka.Equals(data.Plaka) || x.SasiNo.Equals(data.SasiNo)))
                    {
                        ModelState.AddModelError("Plaka", " zaten var");
                        ModelState.AddModelError("SasiNo", " zaten var");
                    }
                    else
                    {
                        ar.Insert(data);
                        return(RedirectToAction("List"));
                    }
                }
            }
            catch (DataException)
            {
                ModelState.AddModelError(string.Empty, "Kayıt Eklenemedi");
            }
            return(View(data));

            #endregion
        }
Exemple #2
0
 public bool InsertArac(Arac entity)
 {
     try
     {
         bool isSuccess;
         using (var repo = new AracRepository())
         {
             isSuccess = repo.Insert(entity);
         }
         return(isSuccess);
     }
     catch (Exception ex)
     {
         LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true);
         throw new Exception("BusinessLogic:AracBusiness::InsertArac::Error occured.", ex);
     }
 }
 public bool AracEkle(Arac arac)
 {
     try
     {
         bool isSuccess;
         using (var repo = new AracRepository())
         {
             isSuccess = repo.Insert(arac);
         }
         return(isSuccess);
     }
     catch (Exception ex)
     {
         LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true);
         throw new Exception("Business:AracBusiness::AracEkle::Hata Oluştu.", ex);
     }
 }