public ActionResult Reports() { bool result = _security.AsUser(); if (result == true) { string userID = Session["userID"].ToString(); List <Category> cat = new List <Category>(); var model = new DaysOffWithEX(); var categorysOfSuper = _db.UserAccess.Where(f => f.userID.ToString() == userID).Select(f => f.cateID).ToList(); foreach (var item in categorysOfSuper) { var res = _db.Category.Where(f => f.id == item && f.Status == false).FirstOrDefault(); cat.Add(res); } model.CategoryX = cat; return(View(model)); } return(RedirectToAction("HavntAccess", "Employee")); }
public ActionResult Create() { bool result = _security.AsAdmin(); if (result == false) { var model = new DaysOffWithEX(); List <Category> res = filldrop(); model.CategoryX = res; return(View(model)); } return(RedirectToAction("HavntAccess", "Employee")); }
public List <Category> filldrop() { string userID = Session["userID"].ToString(); List <Category> cat = new List <Category>(); var model = new DaysOffWithEX(); var categorysOfSuper = _db.UserAccess.Where(f => f.userID.ToString() == userID).Select(f => f.cateID).ToList(); foreach (var item in categorysOfSuper) { var res = _db.Category.Where(f => f.id == item && f.Status == false).FirstOrDefault(); cat.Add(res); } return(cat); }
// GET: Employee public ActionResult Index() { bool result = _security.AsAdmin(); if (result == true) { // table1.GroupBy(x => x.Text).Select(x => x.FirstOrDefault()); ViewBag.Category = new SelectList(_db.Category.GroupBy(f => f.CategoryName).Select(f => f.FirstOrDefault()).Where(f => f.Status == false), "id", "CategoryName"); var model = new DaysOffWithEX(); model.EmpX = _db.Employee.OrderByDescending(f => f.empID).ToList(); model.CategoryX = _db.Category.ToList(); return(View(model)); } return(RedirectToAction("HavntAccess", "Employee")); }
public ActionResult Create(DaysOFF model, string NumberOfMahdar, string Cat, int PublisherID, string Number, TimeSpan DateFrom, TimeSpan DateTo, DateTime reportDate, DateTime DayofDate) { model.Number = NumberOfMahdar; model.CategoryName = Cat; model.empID = PublisherID; model.Number = Number; model.DateFrom = DateFrom; model.DateTo = DateTo; model.reportDate = reportDate; model.DayofDate = DayofDate; _db.DaysOFF.Add(model); _db.SaveChanges(); var models = new DaysOffWithEX(); List <Category> res = filldrop(); models.CategoryX = res; return(View(models)); }