Пример #1
0
 private Role Add()
 {
     var role = new Role
     {
         Name = "test_" + _time,
         CreateTime = DateTime.Now,
         OrgId = 1
     };
     _app.AddOrUpdate(role);
     return role;
 }
Пример #2
0
 public void AddOrUpdate(Role role)
 {
     if (role.Id == 0)
     {
         role.CreateTime = DateTime.Now;
         _repository.Add(role);
     }
     else
     {
         _repository.Update(role);
     }
 }
Пример #3
0
 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);
     
 }
Пример #4
0
 public string Add(Role role)
 {
     try
     {
         _app.AddOrUpdate(role);
     }
     catch (Exception ex)
     {
         BjuiResponse.statusCode = "300";
         BjuiResponse.message = ex.Message;
     }
     return JsonHelper.Instance.Serialize(BjuiResponse);
 }
Пример #5
0
 public Role Find(int id)
 {
     var role = _repository.FindSingle(u => u.Id == id);
     if (role == null) role = new Role();
     return role;
 }