protected override void Seed(Project_Management.Models.ApplicationDbContext context) { // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. roleManagement.CreateRole("Developer"); roleManagement.CreateRole("Admin"); }
private void btnCreate_Click(object sender, EventArgs e) { string RoleName = txtRolename.Text; string DescripRole = txtDescripRole.Text; if (CheckFields() == true) { MetroMessageBox.Show(this, "Debe completar todos los campos", "Error en Validación", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { ObjRole.Name_role = RoleName; ObjRole.Descrip_role = DescripRole; ObjRole.CreateBy = pIdSession; ApiAccess.CreateRole(ObjRole); } catch (Exception) { throw; } CleanFields(); LoadDataGrid(); LoadDataGridAsgRole(); } }
public void TestCreateRole() { ReturnMessage msg = RoleManagement.CreateRole("test", "test"); Assert.IsTrue(msg.Succeed); }