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); } }
// 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)); }
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)); } }
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; }
public DepartmanService() { _departmanRepository = new DepartmanRepository(); }
public ActionResult Listele() { return(View(DepartmanRepository.GetList().ToList())); }
public BaseController() { context = new RehberContext(); CalisanRepository = new CalisanRepository(context); DepartmanRepository = new DepartmanRepository(context); }