private Role Add() { var role = new Role { Name = "test_" + _time, CreateTime = DateTime.Now, OrgId = 1 }; _app.AddOrUpdate(role); return role; }
public void AddOrUpdate(Role role) { if (role.Id == 0) { role.CreateTime = DateTime.Now; _repository.Add(role); } else { _repository.Update(role); } }
public void TestDel() { var role = new Role { Name = "即将删除" + _time, CreateTime = DateTime.Now, OrgId = 1 }; _app.AddOrUpdate(role); Console.WriteLine("new role:" + role.Id); _app.Delete(role.Id); }
public string Add(Role role) { try { _app.AddOrUpdate(role); } catch (Exception ex) { BjuiResponse.statusCode = "300"; BjuiResponse.message = ex.Message; } return JsonHelper.Instance.Serialize(BjuiResponse); }
public Role Find(int id) { var role = _repository.FindSingle(u => u.Id == id); if (role == null) role = new Role(); return role; }