// specialita: primary key je GUID a to framework nevie public UserView CreateUser(CreateUser request) { User rec = request.ConvertToEntity(); rec.D_User_Id = Guid.NewGuid(); rec.DatumVytvorenia = DateTime.Now; rec.DatumZmeny = DateTime.Now; rec.Vytvoril = Session.UserIdGuid; //Univerzálne heslo pre prvé prihlásenie. Pri vytváraní sa už heslo nezadáva. var passwordHasher = HostContext.TryResolve <ServiceStack.Auth.IPasswordHasher>(); rec.LoginPswd = passwordHasher.HashPassword("|T7RLgKSEPM*"); Create(rec); //Specialny pripad s GUID ako ID var tenantUser = new UserTenant() { D_User_Id = rec.D_User_Id, D_Tenant_Id = Session.TenantIdGuid.Value, DatumVytvorenia = DateTime.Now, DatumZmeny = DateTime.Now, Vytvoril = Session.UserIdGuid }; Create(tenantUser); GrantUserPermToDms(tenantUser.D_Tenant_Id); var u = GetList <UserView>(t => t.D_User_Id == rec.D_User_Id).FirstOrDefault(); InvalidateTreeCountsForPath("cfe-admin-users"); return(u); }