public bool CreateGuild(string name, string notice, Character leader) { DateTime now = DateTime.Now; TGuild dbGuild = DBService.Instance.Entities.Guilds.Create(); dbGuild.Name = name; dbGuild.Notice = notice; dbGuild.LeaderID = leader.Id; dbGuild.LeaderName = leader.Name; dbGuild.CreateTime = now; DBService.Instance.Entities.Guilds.Add(dbGuild); Guild guild = new Guild(dbGuild); guild.AddMember(leader.Id, leader.Name, leader.Data.Class, leader.Data.Level, GuildTitle.President); leader.Guild = guild; DBService.Instance.Save(); leader.Data.GuildId = dbGuild.Id; DBService.Instance.Save(); this.AddGuild(guild); return(true); }
public Guild(TGuild guild) { this.Data = guild; }