Example #1
0
        public string AjaxDeleteDepartman()
        {
            // 0 - silme işlemi başarısız oldu
            // 1 - Silme işlemi başarılı oldu
            string    donenkod = "0";
            int       ID       = Convert.ToInt32(Request.Form["id"]);
            Departman d        = DepartmanRepository.Find(ID);

            if (d.Calisans.Count > 0)
            {
                return(donenkod);
            }
            else
            {
                try
                {
                    DepartmanRepository.Delete(ID);
                    DepartmanRepository.Save();

                    donenkod = "1";
                }
                catch (Exception ex)
                {
                }
                return(donenkod);
            }
        }
Example #2
0
        // GET: Admin/Home
        public ActionResult Index()
        {
            HomeViewModel hvm = new HomeViewModel();

            hvm.ToplamCalisan   = CalisanRepository.Count(x => x.Id > 0);
            hvm.ToplamDepartman = DepartmanRepository.Count(x => x.Id > 0);
            return(View(hvm));
        }
Example #3
0
 public ActionResult Ekle(Departman model)
 {
     try
     {
         Departman d = new Departman();
         d.Ad = model.Ad;
         DepartmanRepository.Add(d);
         DepartmanRepository.Save();
         ViewBag.SuccessText = "Kayıt Başarı ile eklendi";
         return(RedirectToAction("Listele"));
     }
     catch (Exception ex)
     {
         ViewBag.ErrorText = " Hata Açıklaması: " + ex.ToString();
         return(View(model));
     }
 }
Example #4
0
        void DepartmanYukle(int DepartmanId)
        {
            List <SelectListItem> SelectList    = new List <SelectListItem>();
            List <Departman>      DepartmanList = DepartmanRepository.GetList().ToList();

            foreach (var item in DepartmanList)
            {
                bool state = false;
                if (DepartmanId == item.Id)
                {
                    state = true;
                }

                SelectList.Add(new SelectListItem {
                    Text = item.Ad, Value = item.Id.ToString(), Selected = state
                });
            }
            ViewBag.DepartmanID = SelectList;
        }
Example #5
0
 public DepartmanService()
 {
     _departmanRepository = new DepartmanRepository();
 }
Example #6
0
 public ActionResult Listele()
 {
     return(View(DepartmanRepository.GetList().ToList()));
 }
Example #7
0
 public BaseController()
 {
     context             = new RehberContext();
     CalisanRepository   = new CalisanRepository(context);
     DepartmanRepository = new DepartmanRepository(context);
 }