/// <summary> /// addressアイテムを追加します。 /// </summary> /// <param name="address"></param> /// <returns></returns> public AddressItem Add(AddressItem address) { if (string.IsNullOrEmpty(address.Id)) { address.Id = Guid.NewGuid().ToString(); } // Save var cl = GetDatabaseClient(); var sql = $"insert into [address] (Id,Name,TellNum,Email,Company,Memo,UserName) VALUES (@Id,@Name,@TellNum,@Email,@Company,@Memo,@UserName)"; var p = new Dictionary <string, object> { { "Id", address.Id }, { "Name", address.Name }, { "TellNum", address.TellNum }, { "Email", address.Email }, { "Company", address.Company }, { "Memo", address.Memo }, { "UserName", address.UserName } }; cl.ExecuteSql(sql, p); // Get return(Get(address.Id)); }
/// <summary> /// addressアイテムを更新します。 /// </summary> /// <param name="address"></param> /// <returns></returns> public AddressItem Update(AddressItem address) { // Save var cl = GetDatabaseClient(); var sql = $"update ADDRESS set Name = @Name, Memo = @Memo, Email=@Email, TellNum=@TellNum,Company=@Company where Id = @Id"; var p = new Dictionary <string, object> { { "Id", address.Id }, { "Name", address.Name }, { "TellNum", address.TellNum }, { "Email", address.Email }, { "Company", address.Company }, { "Memo", address.Memo }, { "UserName", address.UserName } }; cl.ExecuteSql(sql, p); // Get return(Get(address.Id)); }