public ActionResult Create(TBL_GROUP_ROLE collection) { try { // TODO: Add insert logic here return(RedirectToAction("Index")); } catch { return(View()); } }
public bool Delete(int maNhom, int maQuyen) { TBL_GROUP_ROLE PQNVExist = context.TBL_GROUP_ROLEs.Where(t => t.ID_GROUP == maNhom && t.ID_ROLE == maQuyen).FirstOrDefault(); if (PQNVExist == null) { return(false); } context.TBL_GROUP_ROLEs.Remove(PQNVExist); context.SaveChanges(); return(true); }
public bool Add(int id, PhanQuyenNVViewModel model) { if (model.Quyens?.Count > 0) { foreach (var idrole in model.Quyens) { var grouprole = new TBL_GROUP_ROLE { ID_GROUP = id, ID_ROLE = idrole, ACTIVATE = true }; context.TBL_GROUP_ROLEs.Add(grouprole); } } context.SaveChanges(); return(true); }