public ActionResult Create([Bind(Include = "e_Id,e_Name")] AuthenticationTest.Models.tbl_emp tbl_emp) { if (ModelState.IsValid) { db.employee.Add(tbl_emp); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbl_emp)); }
public ActionResult Create(tbl_dept tbl_dept) { if (ModelState.IsValid) { db.departments.Add(tbl_dept); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbl_dept)); }
public ActionResult Create([Bind(Include = "U_Id,username,password,Role_id")] tbl_users tbl_users) { if (ModelState.IsValid) { db.users.Add(tbl_users); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Role_id = new SelectList(db.roles, "Role_Id", "role_name", tbl_users.Role_id); return(View(tbl_users)); }
public ActionResult Create(tbl_roles tbl_roles, IEnumerable <int> PermissionSelect) { if (ModelState.IsValid) { if (PermissionSelect != null) { var actions = db.role_actions.Where(a => PermissionSelect.Contains(a.Action_Id)).ToList(); foreach (var item in actions) { tbl_roles.tbl_role_actions.Add(item); } } db.roles.Add(tbl_roles); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbl_roles)); }
public ActionResult Edit(tbl_users tbl_users) { if (ModelState.IsValid) { string st = tbl_users.signature; string ss = "data:image/png;base64," + st; if (st != "" && st != null) { tbl_users.signature = ss; } db.Entry(tbl_users).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }