public OpResult SaveRole(ProductRole obj) { if (obj.Id == 0) { obj.RoleId = ProductRoleRepository.GetMaxInt(o => o.RoleId, whereLambda: o => o.RoleVerId == obj.RoleVerId); obj.CreateDT = DateTime.Now; obj.CreateUID = CurrentUser.UID; ProductRoleRepository.Add(obj, false); } else { var role = ProductRoleRepository.Get(obj.Id); role.Title = obj.Title; } ProductRoleRepository.SaveChanges(); return(OpResult.Success()); }
public ProductRole GetRole(int id) { return(ProductRoleRepository.Get(id)); }