public ActionResult Delete(int id) { if (Session["empName"] != null) { string name = Session["empName"].ToString(); var ss = _db.Employee.Where(d => d.employeeName == name).FirstOrDefault(); var _allowAll = _db.HowCanAcess.Where(s => s.employeeID == ss.id).FirstOrDefault(); if (_allowAll.Setting == true) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } attachmentType att = _db.attachmentType.Find(id); if (att == null) { return(HttpNotFound()); } return(View(att)); } } return(RedirectToAction("HavntAccess", "Employees")); }
public ActionResult DeleteConfirmed(int id) { if (Session["empName"] != null) { string name = Session["empName"].ToString(); var ss = _db.Employee.Where(d => d.employeeName == name).FirstOrDefault(); var _allowAll = _db.HowCanAcess.Where(s => s.employeeID == ss.id).FirstOrDefault(); if (_allowAll.Setting == true) { attachmentType att = _db.attachmentType.Find(id); _db.attachmentType.Remove(att); _db.SaveChanges(); TempData["AttachmentDelete"] = "تم حذف نوع المستند"; return(RedirectToAction("attachments")); } } return(RedirectToAction("HavntAccess", "Employees")); }
public ActionResult NewattachmentsType(string attType, attachmentType att) { if (Session["empName"] != null) { string name = Session["empName"].ToString(); var ss = _db.Employee.Where(d => d.employeeName == name).FirstOrDefault(); var _allowAll = _db.HowCanAcess.Where(s => s.employeeID == ss.id).FirstOrDefault(); if (_allowAll.Setting == true) { if (attType != null || attType != " ") { att.AttType = attType; _db.attachmentType.Add(att); _db.SaveChanges(); return(View("attachments", _db.attachmentType.ToList())); } return(View("attachments", _db.attachmentType.ToList())); } } return(RedirectToAction("HavntAccess", "Employees")); }