public Sys_DataPermissionModel Post([FromBody] Sys_DataPermissionModel model) { var service = new Sys_DataPermissionServices(); var dataPermissionExist = service.CheckDuplicateDataPermission(model.UserID, model.GroupID); if (dataPermissionExist.ID != Guid.Empty) { model.ID = dataPermissionExist.ID; } byte[] branches = null; if (model.Branches != null) { branches = model.Branches.ToBinary(); } var entity = new Sys_DataPermissionEntity { ID = model.ID, Code = model.Code, Branches = branches, GroupID = model.GroupID, UserID = model.UserID, DataGroup = model.DataGroup, DataGroups = model.DataGroups, OrgStructure = model.OrgStructure, WorkPlace = model.WorkPlace }; if (model.ID != Guid.Empty) { model.ID = model.ID; service.Edit <Sys_DataPermissionEntity>(entity); } else { service.Add <Sys_DataPermissionEntity>(entity); model.ID = entity.ID; } return(model); }
public void NUnit_DataPermission_Domain_Edit() { Sys_DataPermissionServices service = new Sys_DataPermissionServices(); var model = new Sys_DataPermission { Id = 3, Code = "3", UserID = 1, GroupID = 1 }; var result = service.Edit <Sys_DataPermission>(model); // NUnit.Framework.Assert.IsTrue(result); if (result == ActionStatus.EditSucceed.ToString()) { Console.WriteLine("Process Success >>> Update >>> " + model.Id + " | " + model.Code + " | " + model.UserID + " | " + model.GroupID ); } }
public void NUnit_DataPermission_Domain_Edit() { Sys_DataPermissionServices service = new Sys_DataPermissionServices(); var model = new Sys_DataPermission { Id = 3, Code = "3", UserID = 1, GroupID = 1 }; var result = service.Edit<Sys_DataPermission>(model); // NUnit.Framework.Assert.IsTrue(result); if (result == ActionStatus.EditSucceed.ToString()) { Console.WriteLine("Process Success >>> Update >>> " + model.Id + " | " + model.Code + " | " + model.UserID + " | " + model.GroupID ); } }